1 Star 0 Fork 270

Yuzhuchao / authbase

forked from Jeffrey / authbase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
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()
Python
1
https://gitee.com/yuzhuchao/authbase.git
git@gitee.com:yuzhuchao/authbase.git
yuzhuchao
authbase
authbase
master

搜索帮助