title: Python / Flask background process dies
body: <p>NB! This is a repost of the question. My original post was closed because someone thought I asked about how I could configure a Flask app for production or to run in background. This is not the question. The question is why the python background process suddenly dies.</p>
  <p>I am running a Flask application on Ubuntu (using development server) with the following command line:</p>
  <p>python myflaskapp.py &gt; log.txt 2&gt;&amp;1 &amp;</p>
  <p>After I log off the ssh session - it runs fine for a while but then suddenly the process dies. There are no requests to it that causes it either. It just dies. The application is really simple. There are no DB connections or anything. It just receives some file upload and uses XLRD to convert it to csv. But it dies after a while even if no requests are sent to it.</p>
  <p>Any ideas what causes this? Any way of logging it? There are no log entries in log.txt that shows whats going on either.</p>
  <p>I know that I am not supposed to run development server for production, and I am running it also in gunicorn now - but I would really like to know why the Python process dies.</p>
  <p>I have another Flask application and that one &quot;lives forever&quot;. It is built in the same way - but that process will live until the computer boots or some unhandled exception occurs.</p>