Proper way to handle static files and templates for Django on Heroku

后端 未结 2 1486
你的背包
你的背包 2020-12-22 22:27

I\'m moving over my django app to Heroku, and I was wondering what the proper way to handle static files is. Do I just push them via git to Heroku? Or should I be storing th

2条回答
  •  一个人的身影
    2020-12-22 23:17

    While @Intenex's answer might still be the way to go if you have a lot of static content, for getting started, Heroku suggests using Whitenoise.

    Here's Heroku's article aptly entitled "Django and Static Assets".

    And the whitenoise documentation itself has a nice section on "Shouldn’t I be pushing my static files to S3 using something like Django-Storages?"

提交回复
热议问题