title: Error on Flask-migrate with application factory
body: <p>run.py</p>
  
  <pre><code>db = SQLAlchemy()
  migrate = Migrate()
  
  def create_app():
      app = Flask(__name__)
      db.app = app
      db.init_app(app)
      migrate.init_app(app, db)
      return app
  
  if __name__ == '__main__':
      application = create_app()
      application.run()
  </code></pre>
  
  <p>manage.py</p>
  
  <pre><code>from flask_migrate import MigrateCommand, Manager
  
  from run import create_app
  
  
  manager = Manager(create_app())
  manager.add_command('db', MigrateCommand)
  </code></pre>
  
  <p>When I run: python manage.py db init</p>
  
  <pre><code>Traceback (most recent call last):
    File "manage.py", line 6, in &lt;module&gt;
      manager = Manager(create_app())
  TypeError: 'NoneType' object is not callable
  </code></pre>
  
  <p>When I run: flask db init</p>
  
  <pre><code>Usage: flask db init [OPTIONS]
  
  Error: Could not locate Flask application. You did not provide the FLASK_APP environment variable.
  
  For more information see http://flask.pocoo.org/docs/latest/quickstart/
  </code></pre>
  
  <p>I try to export FLASK_APP as run, run.py, run.create_app, run:create_app(), yet I still get the error shown above.  What is causing this error?</p>