1 Star 0 Fork 337

柴俊/authbase

forked from Jeffrey/authbase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
manager.py 940 Bytes
一键复制 编辑 原始数据 按行查看 历史
test@test.com 提交于 2019-01-09 14:08 . 升级支持Python 3
#!/usr/bin/env python
import os
from app import create_app, db
from app.models import User, Role, Resource, ResourceType, Organization
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
from flask import g, render_template
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
@app.errorhandler(404)
def page_not_found(e):
return render_template('errors/404.html'), 404
with app.app_context():
g.contextPath = ''
def make_shell_context():
return dict(app=app, db=db, User=User, Role=Role, Resource=Resource,
ResourceType=ResourceType, Organization=Organization)
manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)
@manager.command
def myprint():
print('hello world')
if __name__ == '__main__':
manager.run()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/cj_go123/authbase.git
git@gitee.com:cj_go123/authbase.git
cj_go123
authbase
authbase
master

搜索帮助