Why does DEBUG=False setting make my django Static Files Access fail?

后端 未结 14 1909
忘了有多久
忘了有多久 2020-11-22 05:16

Am building an app using Django as my workhorse. All has been well so far - specified db settings, configured static directories, urls, views etc. But trouble started sneaki

相关标签:
14条回答
  • 2020-11-22 06:06

    With debug turned off Django won't handle static files for you any more - your production web server (Apache or something) should take care of that.

    0 讨论(0)
  • 2020-11-22 06:08

    I did the following changes to my project/urls.py and it worked for me

    Add this line : from django.conf.urls import url

    and add : url(r'^media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT, }), in urlpatterns.

    0 讨论(0)
提交回复
热议问题