1
votes

I have my Django app up and running using Gunicorn+Nginx on a shared hosting, but I don't have access to my nginx configuration file (because of shared hosting, I create an "app" on my hosting Control panel which is automatically added as a virtual host with a specific port, and I use that port to start my Gunicorn).

Is there a way to set my cache expire headers for static files like css and jpg? Nginx obviously doesn't have something like .htaccess which would make this easier.

Maybe there's a way that would make Django or Gunicorn "push" some configuration (location etc.) to Nginx?

1

1 Answers

0
votes

You can control the HTTP headers that are returned in your app's responses without access to the web server sitting in front of Django. Django's documentation provides a number of scenarios with instructions on what to do. Hopefully this is enough to get you started.

I'd actually recommend this over changing it in your web server configuration as it means your caching configuration is part of your application code, and your application's behaviour isn't determined by an 'outside' configuration.