Django static files on heroku

后端 未结 5 1519
借酒劲吻你
借酒劲吻你 2020-12-05 05:09

I deployed a django app to heroku, using \"git push heroku master\" which worked absolutely fine.

I then created a second app on the same git using \"heroku create s

5条回答
  •  情歌与酒
    2020-12-05 05:49

    It seems that it's because you're using the staticfiles app without having set the STATIC_ROOT setting.

    In comparison, my settings.py is something like:

    # Static asset configuration
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))
    STATIC_ROOT = 'staticfiles'
    STATIC_URL = '/static/'
    STATICFILES_DIRS = (
        os.path.join(BASE_DIR, '../myapp/static')
    

    You should set the STATICFILES_DIRS too (note that my conf for this var is probably not the same than yours)

    Then, push your code and try again. If it still doesn't work, you can use this to debug : https://devcenter.heroku.com/articles/django-assets#debugging

提交回复
热议问题