title: How to run gunicorn/a python app server as a non-root user?
body: <p>I'm deploying a django app with gunicorn behind nginx on centos 5. How can I run gunicorn as a non-root user? None of the documentation seems to address this. This probably applies to any python application server running behind nginx as well...</p>
  
  <p>I should add that the following doesn't work:</p>
  
  <pre><code>sudo -u nobody gunicorn_django --workers=4
  </code></pre>
  
  <p>It fails with:</p>
  
  <pre><code>raise HaltServer(reason, self.WORKER_BOOT_ERROR)
      gunicorn.errors.HaltServer: &lt;HaltServer 'Worker failed to boot.' 3&gt;
  </code></pre>
  
  <p>Answer:</p>
  
  <p>My mistake. I had a custom settings.py file so should have invoked gunicorn with:</p>
  
  <pre><code>sudo -u nobody gunicorn_django --workers=4 production_settings.py
  </code></pre>