# -*- coding: utf-8 -*-
"""FIXME: this module doesn't work since db object imported from
url_shortener package does not contain any mappings. It receives mappings
only in url_shortener/__main__.py, because right now this is where Injector
is instantiated and configured for application instance, creating TargetURL
class.

This will be fixed when introducing application factory. Until then, no
temporary fixes will be made.
"""
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from url_shortener import app
from url_shortener.models import db

app.config.from_envvar('URL_SHORTENER_CONFIGURATION')

migrate = Migrate(app, db)
manager = Manager(app)

manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()

@@ -21,413 +21,8 @@
 -*-%0A
-%22%22%22FIXME: this module doesn't work since db object imported from%0Aurl_shortener package does not contain any mappings. It receives mappings%0Aonly in url_shortener/__main__.py, because right now this is where Injector%0Ais instantiated and configured for application instance, creating TargetURL%0Aclass.%0A%0AThis will be fixed when introducing application factory. Until then, no%0Atemporary fixes will be made.%0A%22%22%22%0A
 from
@@ -131,71 +131,48 @@
 ort 
-app%0Afrom url_shortener.models import db%0A%0Aapp.config.from_envvar
+get_app_and_db%0A%0Aapp, db = get_app_and_db
 ('UR
@@ -197,16 +197,34 @@
 URATION'
+, from_envvar=True
 )%0A%0Amigra

Fix manage.py