Django staticfiles not found on Heroku (with whitenoise)

后端 未结 8 1395
我在风中等你
我在风中等你 2020-12-01 18:29

This question seems to be asked several time but I can not fix it.

I deployed a django app on production with DEBUG = False. I set my allowed_hos

8条回答
  •  春和景丽
    2020-12-01 19:04

    In addition to above answers, it can also be that you have not specified a correct STATIC_ROOT as described in https://docs.djangoproject.com/en/2.0/howto/static-files/#deployment

    For me, the solution was adding this to the end of my production settings.py

    STATIC_ROOT = "/app/static/"
    

    To know where your static folder is in your heroku run this

    heroku run python manage.py collectstatic
    

    Then you will see the path being shown there.

提交回复
热议问题