You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path

前端 未结 3 1434
感情败类
感情败类 2021-01-12 16:51

I have gone through every other answer and cannot seem to get anything to work for me. I am following a tutorial and trying to push my master branch to heroku a

3条回答
  •  醉话见心
    2021-01-12 17:28

    On this website it says to add this url pattern to your project:

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

    I haven't used heroku before but IF I understand correctly, it needs a path to send all the collected static files to. Usually that's in the server's settings. But the website above mentions that heroku uses an app which doesn't support static files deployment, and that's why you need a url pattern to make it get the static files from their respective places.

    Also, read the entire tutorial first. They might mention your problem somewhere near the end of the tutorial in like a Notes section. Read the comments also if they exist.

提交回复
热议问题