#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask_script import Manager, Shell
from app import create_app, db


# 读取配置（此配置再数据迁移中被引入）
config_name = (os.getenv('FLASK_CONFIG') or 'default')
app = create_app(config_name)
manager = Manager(app)


def make_shell_context():
    return dict(app=app, db=db)

manager.add_command('shell', Shell(make_context=make_shell_context))


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