datamade / how-to

📚 Doing all sorts of things, the DataMade way
MIT License
81 stars 12 forks source link

Consider using nginx in our Heroku django apps #238

Closed fgregg closed 2 years ago

fgregg commented 2 years ago

Background

Using straight gunicorn, which is the default heroku setup for django apps can lead to some problems when you have multiple slow connections (as would be common for mobile). Using nginx can address this. Additionally, if nginx is part of our our heroku stack, then we can get control of setting Cache-Controls for static assets.

That in turn would unlock using taking advantage of Django's ManifestStaticFilesStorage and letting browsers cache our static assets.

Proposal

Heroku has an officially supported buildpack for nginx. I'd like to spike an PR on one of our heroku-deployed django apps and see what's involved in switching over.

Deliverables

If the PR looks good, then I'll updated the django cookie cutter template.

Timeline

1 investment day.

hancush commented 2 years ago

We're currently using WhiteNoise for this: http://whitenoise.evans.io/en/stable/

@fgregg is going to verify that it's behaving as expected. If so, we'll close this.

fgregg commented 2 years ago

looks like whitenoise is doing the right thing