Django template can't see CSS files

前端 未结 5 656
北恋
北恋 2021-01-30 09:25

I\'m building a django app and I can\'t get the templates to see the CSS files... My settings.py file looks like:

MEDIA_ROOT = os.path.join(os.path.abspath(os.p         


        
5条回答
  •  清歌不尽
    2021-01-30 10:24

    in the "development only" block in your urls.py you need to change

    (r'^media/(?P.*)$', 'django.views.static.serve',
        {'document_root': '/media'}),
    

    to...

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

提交回复
热议问题