title: Why is SQL Alchemy database engine still None?
body: <p>I am following the factory design pattern. In the WSGI.py file, why does print(db) prints</p>
  <pre><code>&lt;SQLAlchemy engine=None&gt;
  </code></pre>
  <p>I have attached the app to db with db.init_app(app) command in MAIN.py file. Shouldn't the output be</p>
  <pre><code>&lt;SQLAlchemy engine= &quot;sqlite:///site.db&quot;&gt;
  </code></pre>
  <p>My WSGI.py file</p>
  <pre><code>from main import create_app, db
  
  app = create_app(&quot;sqlite:///site.db&quot;)
  print(db)
  
  if __name__ == &quot;__main__&quot; :
      app.run(debug=True)
  </code></pre>
  <p>My MAIN.py file</p>
  <pre><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  
  db = SQLAlchemy()
  def create_app(URI) :
      app = Flask(__name__)
      app.config[&quot;SQLALCHEMY_DATABASE_URI&quot;] = URI
      db.init_app(app)
      return app
      
  </code></pre>