Django — Can't get static CSS files to load

后端 未结 20 1892
借酒劲吻你
借酒劲吻你 2020-11-29 23:45

I\'m running Django\'s development server (runserver) on my local machine (Mac OS X) and cannot get the CSS files to load.

Here are the relevant entries

20条回答
  •  囚心锁ツ
    2020-11-30 00:20

    If you set DEBUG=FALSE you need to do follow steps

    In your urls.py file: add this line

    from django.views.static import serve
    
    url(r'^media/(?P.*)$', serve,{'document_root': settings.MEDIA_ROOT}),
    url(r'^static/(?P.*)$', serve,{'document_root': settings.STATIC_ROOT}),
    
    

提交回复
热议问题