title: How do you disable caching for an nginx+uwsgi+python server?
body: <p>I am trying to do development of a completely fresh website using exclusively nginx, uwsgi, and python.  The problem is that if I change the file that uwsgi points to, and refresh the page, I get the HTML generated by the previous version of the file.  It seems that nginx, uwsgi, or both are caching the code and/or response of my site.  I have been reading up on uwsgi caching but have not been able to disable caching using the <code>--cache2</code> flag and <code>--cache_*</code> flags.  I found <a href="https://stackoverflow.com/questions/7403937/disable-nginx-caching-for-certain-file-types">this other question</a> and also attempted to use</p>
  
  <pre><code>proxy_no_cache "1";
  proxy_cache_bypass "1";
  </code></pre>
  
  <p>in the server's location dictionary (located at /etc/nginx/sites-available/mysite), but alas it still caches the page.  I have used web2py in the past with nginx and uwsgi and it doesn't seem to have this issue when I updated controllers or views.</p>
  
  <p>This is my site file:</p>
  
  <pre><code>server { 
      listen 80 default_server; 
      listen [::]:80 default_server; 
      listen 443 ssl default_server; 
      listen [::]:443 ssl default_server; 
      include snippets/snakeoil.conf; 
      server_name _; 
      location / {
          include uwsgi_params; 
          uwsgi_pass 127.0.0.1:3031;
      }
  }
  </code></pre>
  
  <p>this is the executed program that the init.d script uses:</p>
  
  <pre><code>uwsgi --master --processes 4 --threads 2 --die-on-term -s /tmp/mysock.sock --socket :3031 --uid www-data --gid www-data --vacuum --wsgi-file /path/to/my/python/file.py
  </code></pre>
  
  <p>this is the python file that is loaded:</p>
  
  <pre><code>def application(environ, start_response): 
      start_response('200 OK', [('Content-Type', 'text/html')])
      return ["&lt;h1&gt;Hello World&lt;/h1&gt;"]
  </code></pre>
  
  <p>I understand that caching improves performance, so I intend to turn it back on for a production environment, but developing with it turned on is a pain in the butt... What am I doing wrong?</p>
  
  <p>My only workaround right now is to restart the uwsgi service everytime I make a change :(</p>