The STATICFILES_DIRS setting is not a tuple or list. HINT: Perhaps you forgot a trailing comma?

在使用Django进行开发时,碰到了一个比较隐蔽的问题,其实是一个很简单的问题,但是却很容易忽略,所以用再次作为一个提醒之用。

具体报错信息如下:

ERRORS:
?: (staticfiles.E001) The STATICFILES_DIRS setting is not a tuple or list.
        HINT: Perhaps you forgot a trailing comma?

System check identified 1 issue (0 silenced).

报错的原因是因为我们的STATICFILES_DIRS赋值时,形式不对,其应该赋数组对象,具体如下:

找到settings.py文件,

STATICFILES_DIRS=(os.path.join(BASE_DIR,'static'))

改为

STATICFILES_DIRS=[(os.path.join(BASE_DIR,'static'))]

原文:https://blog.csdn.net/dbc_121/article/details/83515371

原文地址:https://www.cnblogs.com/cheflone/p/13666848.html