在settings.py文件中,MEDIA_ROOT和STATIC_ROOT 变量的值都以逗号结尾,而 逗号会将这些变量的值从字符串转换为元组。
MEDIA_ROOT = os.path.join(BASE_DIR, 'media'), # This is a tuple
STATIC_ROOT = os.path.join(BASE_DIR, 'static'), # So is this
解决方案:
删除结尾的 逗号,就能解决。
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # This is now a string
STATIC_ROOT = os.path.join(BASE_DIR, 'static') # So is this