django heroku media files 404 error

后端 未结 2 1186
情话喂你
情话喂你 2021-01-03 12:59

I recently deployed a Django app to Heroku and uploaded some media files and everything seemed to work fine, until yesterday when i tried to access the application again and

2条回答
  •  醉话见心
    2021-01-03 13:47

    My guess would be that something is off with your static files.

    For example, you have

    STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
    

    For my Heroku app, I have

    STATICFILES_DIRS = (
        os.path.join(BASE_DIR, 'static'),
    )
    

    Settings for static files is something that few people seem to really understand (including myself), but this blog post offers a pretty good explanation: http://blog.doismellburning.co.uk/2012/06/25/django-and-static-files/

提交回复
热议问题