title: I get KeyError when trying to run "flask db init"
body: <p>Hi I am new to python and I am following a flask + python tutorial but when executing the command <code>flask db init</code> it gives me this :</p>
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    
  File &quot;/home/pi/.local/bin/flask&quot;, line 10, in &lt;module&gt;
      sys.exit(main())
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/flask/cli.py&quot;, line 967, in main
      cli.main(args=sys.argv[1:], prog_name=&quot;python -m flask&quot; if as_module else None)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/flask/cli.py&quot;, line 586, in main
      return super(FlaskGroup, self).main(*args, **kwargs)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/click/core.py&quot;, line 782, in main
      rv = self.invoke(ctx)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/click/core.py&quot;, line 1259, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/click/core.py&quot;, line 1259, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
   
  File &quot;/home/pi/.local/lib/python2.7/site-packages/click/core.py&quot;, line 1066, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/click/core.py&quot;, line 610, in invoke
      return callback(*args, **kwargs)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/click/decorators.py&quot;, line 21, in new_func
      return f(get_current_context(), *args, **kwargs)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/flask/cli.py&quot;, line 425, in decorator
      with __ctx.ensure_object(ScriptInfo).load_app().app_context():
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/flask/cli.py&quot;, line 388, in load_app
      app = locate_app(self, import_name, name)
    
  File &quot;/home/pi/.local/lib/python2.7/site-packages/flask/cli.py&quot;, line 240, in locate_app
      __import__(module_name)
    
  File &quot;/home/pi/ACSD/run.py&quot;, line 6, in &lt;module&gt;
      app = create_app(config_name)
    
  File &quot;/home/pi/ACSD/app/__init__.py&quot;, line 12, in create_app
      app.config.from_object(app_config[config_name])
  
  KeyError: None
  </code></pre>
  <p>This is the content of the <code>__init__.py</code> file:</p>
  <pre><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from flask_login import LoginManager
  from flask_migrate import Migrate
  from config import app_config
  
  db = SQLAlchemy()
  login_manager = LoginManager()
  
  def create_app(config_name):
      app = Flask(__name__, instance_relative_config=True)
      app.config.from_object(app_config[config_name])
      app.config.from_pyfile('config.py')
      db.init_app(app)
      login_manager.init_app(app)
      login_manager.login_message = &quot;You must be logged in to access this page.&quot;
      login_manager.login_view = &quot;auth.login&quot;
      migrate = Migrate(app, db)
  
      from app import models
  
      return app
  </code></pre>
  <p>This is the content of the run.py file</p>
  <pre><code>import os
  
  from app import create_app
  
  config_name = os.getenv('FLASK_CONFIG')
  app = create_app(config_name)
  
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  <p>All help is appreciated</p>