Heroku static files not loading, Django

前端 未结 5 478
春和景丽
春和景丽 2021-01-03 14:43

I\'m trying to push my Django project to Heroku, but it isn\'t loading the staticfiles.

I used this to setup the things, everything is fine but I\'m not able to fix

5条回答
  •  [愿得一人]
    2021-01-03 15:39

    Your urls.py file lacks the setting to manage and route requests for static resources.

    in order to provide access to static resorces you must add to urlpatterns of urls.py:

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

提交回复
热议问题