title: Problems running flask app on uwsgi / nginx
body: <p>I have created a flask app and up to this point have been using the default flask server for creating/testing it. Now i want to deploy it to a server. I am using uwsgi and nginx, though i am pretty new to both. i know there are a lot of guides and questions about similar things, but i couldnt find the solution after looking through as much as i could understand</p>
  
  <p>The following is from my uwsgi log :</p>
  
  <pre><code>machine: x86_64
  clock source: unix
  detected number of CPU cores: 1
  current working directory: /home/ben/flask/MLS-Flask
  detected binary path: /home/ben/flask/MLS-Flask/mls-flask-ve/bin/uwsgi
  !!! no internal routing support, rebuild with pcre support !!!
  *** WARNING: you are running uWSGI without its master process manager ***
  your processes number limit is 1024
  your memory page size is 4096 bytes
  detected max file descriptor number: 1024
  lock engine: pthread robust mutexes
  thunder lock: disabled (you can enable it with --thunder-lock)
  uwsgi socket 0 bound to UNIX address /home/ben/flask/MLS-Flask/mls_uwsgi.sock fd 3
  Python version: 3.3.3 (default, Dec 30 2013, 16:29:41)  [GCC 4.4.7 20120313 (Red Hat    4.4.7-4)]
  Set PythonHome to /home/ben/flask/MLS-Flask/mls-flask-ve
  *** Python threads support is disabled. You can enable it with --enable-threads ***
  Python main interpreter initialized at 0x11755d0
  your server socket listen backlog is limited to 100 connections
  your mercy for graceful operations on workers is 60 seconds
  mapped 72760 bytes (71 KB) for 1 cores
  *** Operational MODE: single process ***
  added /home/ben/flask/MLS-Flask/ to pythonpath.
  WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x11755d0 pid: 2926 (default app)
   *** uWSGI is running in multiple interpreter mode ***
  spawned uWSGI worker 1 (and the only) (pid: 2926, cores: 1)
  </code></pre>
  
  <p>I am assuming the uwsgi is at least running? I am fairly new to this so i am not quite sure that the problem is.</p>
  
  <p>my nginx config is :</p>
  
  <pre><code>server{
  
      listen  8080;
      charset utf-8;
  
      location / {try_files $uri @app; }
      location @app {
          include uwsgi_params;
          uwsgi_pass unix:/home/ben/flask/MLS-Flask/mls_uwsgi.sock;
      }
  }
  </code></pre>
  
  <p>my uwsgi ini is :</p>
  
  <pre><code>[uwsgi]
  
  uid = nginx
  gid = nginx
  
  base = /home/ben/flask/MLS-Flask
  
  home = %(base)/mls-flask-ve
  pythonpath = %(base)
  
  chdir = /home/ben/flask/MLS-Flask
  
  module = runp
  
  #socket file's location
  socket = /home/ben/flask/MLS-Flask/mls_uwsgi.sock
  
  #permissions for the socket file
  chmod-socket = 666
  
  #variable that holds a flask application inside the module imported
  callable = app
  
  #location of log file
  logto = /var/log/uwsgi/%n.log
  </code></pre>
  
  <p>and the file the uwsgi ini is running is my flask app:</p>
  
  <pre><code>from app import app
  
  
  if __name__ == "__main__":
      app.run(debug = False, port = 8080)
  </code></pre>
  
  <p>I may have some extraneous stuff in my uwsgi ini or nginx config, but i am not sure if those would necessarily be the problems. Can anyone see any reasons why this might not be working? I am currently getting a 502 bad gateway error on localhost:8080, so i am guessing it has something to do with my flask, uwsgi ini/socket.</p>
  
  <p>i appreciate any help.</p>