title: Where to put the debug flag in flask applications
body: <p>Reading the flask documentation I see that there are two places where usually put the debug flag:</p>
  
  <ul>
  <li><p>after the creation of the flask object</p>
  
  <pre><code>app = Flask(__name__)
  app.debug = True
  </code></pre></li>
  <li><p>or by the run method</p>
  
  <pre><code>app.run(host='0.0.0.0', debug = True)
  </code></pre></li>
  </ul>
  
  <p>In my project I have the app/<strong>init</strong>.py file:</p>
  
  <pre><code>    from flask import Flask
      app = Flask(__name__) 
      #app.debug = True       
      from app import views
      if app.debug == True:
         ...
         ...
  </code></pre>
  
  <p>And the run.py file:</p>
  
  <pre><code>from app import app
  import os
  port = int(os.environ.get('PORT', 5000))
  app.run(host='0.0.0.0', port=port, debug = True)
  </code></pre>
  
  <p>The problem that I see with the second option (by app.run) is that the True value won't be set until executing the run method. Because that, in my <strong>init</strong>.py file I will have the default value of app.debug (False). By the first option I don't have that problem.</p>
  
  <p>Is the above right or is there anything that I don't see? What is then the best place to put the debug value regardless the application?</p>