Serving static files on heroku


Question

I'm writing a Python app for heroku. Flask is used for the web component of the app.

My problem is that I can't find a way to serve static files. I don't want to do it through flask because that is very inefficient.

I'm also using gunicorn. How would I set up serving of static files?

1
6
1/30/2013 1:03:41 AM

Accepted Answer

Try using Amazon s3 for storing static and media files. A similar question and answer can be found here. Here is heroku's documentation of using s3. Then you might want to disable automatic collectstatic instructions here so collectstatic isn't run every time you push to heroku. Hope this helps.

7
5/23/2017 12:06:52 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon