django - Server error loading static files

泪湿孤枕 提交于 2019-12-01 22:58:28
Change the your debug into DEBUG=False

You have STATIC_ROOT in STATICFILES_DIRS ! That's incorrect.

Not sure if your issue is related to that, but it definitively show a lack of understanding of django staticfiles management.

Maybe after reading this article you'll understand it fully and be able to set it up right.

And you don't need this with DEBUG=True:

urlpatterns += patterns('',
(r'^static/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
)

Well, I had the same problem, and then I saw this error message:

"Your STATICFILES_DIRS setting is not a tuple or list; " django.core.exceptions.ImproperlyConfigured: Your STATICFILES_DIRS setting is not a tuple or list; perhaps you forgot a trailing comma?"

So, I converted the result of

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

To a list:

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

Hope this help somebody.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!