title: Using supervisor to run a flask app
body: <p>I am deploying my Flask application on WebFaction. I am using flask-socketio which has lead me to deploying it with a Custom Websocket App (listening on port). Flask-socketio's instructs me to deploy my app by starting the serving with the call socketio.run(app, port= &lt; port_listening_on >) in my main python script. I have installed eventlet on the server so socketio.run should run the app on the eventlet web server.</p>
  
  <p>I can call python &lt; app >.py and all works great – server runs, can view it at the domain, sockets working, etc. My problems start when I attempt to turn this into a long running process. I've been advised to use supervisor which I have installed and configured on my webapp following these instructions: <a href="https://community.webfaction.com/questions/18483/how-do-i-install-and-use-supervisord-to-control-long-running-processes" rel="nofollow">https://community.webfaction.com/questions/18483/how-do-i-install-and-use-supervisord-to-control-long-running-processes</a></p>
  
  <p>The problem is once I actually add the command for supervisor to run my app it errors with:</p>
  
  <pre><code>Exited too quickly
  </code></pre>
  
  <p>My log states the above error as well as:</p>
  
  <pre><code>(exit status 1; not expected)
  </code></pre>
  
  <p>In my supervisor config file I currently have the following program config:</p>
  
  <pre><code>[program:&lt;prog_name&gt;]
  command=/usr/bin/python2.7 /home/&lt;user&gt;/webapps/&lt;app_name&gt;/&lt;app&gt;.py
  autostart=true
  autorestart=true
  </code></pre>
  
  <p>I have tried a removing and adding settings but it all leads to the same FATAL error.</p>