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

后端 未结 14 1942
忘了有多久
忘了有多久 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 05:56

    Although it's not safest, but you can change in the source code. navigate to Python/2.7/site-packages/django/conf/urls/static.py

    Then edit like following:

    if settings.DEBUG or (prefix and '://' in prefix):
    

    So then if settings.debug==False it won't effect on the code, also after running try python manage.py runserver --runserver to run static files.

    NOTE: Information should only be used for testing only

提交回复
热议问题