title: uwsgi + python + nginx + willy nilly file execution
body: <p>I'm using uwsgi on Nginx to run some Python code.</p>
  
  <p>I'd like to bind uwsgi to a directory and make it render any .py file that I call from the server in the browser. I'm thinking like PHP, here (/index.php executes that file, /login.php executes that file).</p>
  
  <p>Is this a possibility? Or am I only able to explicitly specify a single module/app/file in uwsgi?</p>
  
  <p>Here is my init syntax:</p>
  
  <pre><code>/opt/uwsgi/uwsgi -s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pidfile /var/run/uwsgi.pid --pythonpath /srv/www
  </code></pre>
  
  <p>I thought that would allow <code>/srv/www</code> to act as the folder where any .py files are executed.</p>
  
  <p>Here is my nginx config:</p>
  
  <pre><code>server {
      listen       80;
      server_name  DONT_NEED_THIS;
  
      access_log  /srv/www/logs/access.log;
      error_log   /srv/www/logs/error.log;
  
      location / {
          root  /srv/www;
  
          # added lines    
          include        uwsgi_params;
          uwsgi_pass     127.0.0.1:9001;
  
      }
  </code></pre>
  
  <p>As it stands, when I try to call web root (ie www.site.com/) I get a:</p>
  
  <pre><code>wsgi application not found
  </code></pre>
  
  <p>With the following index.py file:</p>
  
  <pre><code>import sys
  import os
  
  sys.path.append(os.path.abspath(os.path.dirname(__file__)))
  
  def application(environ, start_response):
      status = '200 OK'
      output = 'Hello World!'
  
      response_headers = [('Content-type', 'text/plain'),
                          ('Content-Length', str(len(output)))]
      start_response(status, response_headers)
  
      return [output]
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>