title: Deploying Flask app to Heroku stuck in restarting loop
body: <p>I have a simple Flask app that I'm trying to deploy to Heroku, but I'm facing an Application Error and the logs seem to indicate that the app is stuck in some sort of restarting loop. I think there is a problem with my Procfile or run.py but I can't figure out what.
  Here are the Heroku logs:</p>
  
  <pre><code>2014-07-13T03:02:24.579923+00:00 app[web.1]:  * Running on http://127.0.0.1:5000/
  2014-07-13T03:02:24.580216+00:00 app[web.1]:  * Restarting with reloader
  2014-07-13T03:02:29.941158+00:00 app[web.1]: /app/app/mechanize_boilerplate.py:13: UserWarning: gzip transfer encoding is experimental!
  2014-07-13T03:02:29.941168+00:00 app[web.1]:   br.set_handle_gzip(True)
  2014-07-13T03:02:29.955461+00:00 app[web.1]:  * Running on http://127.0.0.1:5000/
  2014-07-13T03:02:29.955738+00:00 app[web.1]:  * Restarting with reloader
  2014-07-13T03:02:35.300236+00:00 app[web.1]:   br.set_handle_gzip(True)
  2014-07-13T03:02:35.300231+00:00 app[web.1]: /app/app/mechanize_boilerplate.py:13: UserWarning: gzip transfer encoding is experimental!
  2014-07-13T03:02:35.314821+00:00 app[web.1]:  * Running on http://127.0.0.1:5000/
  2014-07-13T03:02:35.315107+00:00 app[web.1]:  * Restarting with reloader
  ...
  </code></pre>
  
  <h1>Here is my current project structure:</h1>
  
  <pre><code>/myapplication
      Procfile
      run.py
      requirements.txt
      /app
          __init__.py
          views.py
          mechanize_boilerplate.py
          /static
          /templates
  </code></pre>
  
  <h1>Here is my Procfile</h1>
  
  <pre><code>web: gunicorn run:app
  </code></pre>
  
  <h1>Here is run.py</h1>
  
  <pre><code>#!flask/bin/python
  from app import app
  app.run(debug = True)
  </code></pre>
  
  <h1>Here is <strong>init</strong>.py</h1>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  from app import views
  </code></pre>
  
  <p>From there views.py runs and is pretty classic.
  I've seen a few <a href="https://stackoverflow.com/questions/22416699/heroku-flask-deploy-a-modular-app-from-tutorial-not-working-foreman-start-w?rq=1">similar</a> <a href="https://stackoverflow.com/questions/17260338/deploying-flask-with-heroku">questions</a> and tried playing with my Procfile but couldn't get it work, all I managed to do was crashing the app.
  Any suggestions?</p>