20 lines
715 B
Python
20 lines
715 B
Python
from app import create_app, db
|
|
from app.models import User, Role, Permission, Department, RoleField # 添加所有你的模型
|
|
import logging
|
|
|
|
app = create_app()
|
|
|
|
if __name__ == '__main__':
|
|
# 设置控制台日志
|
|
console_handler = logging.StreamHandler()
|
|
console_handler.setLevel(logging.INFO)
|
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
console_handler.setFormatter(formatter)
|
|
app.logger.addHandler(console_handler)
|
|
|
|
app.run(debug=True)
|
|
|
|
@app.shell_context_processor
|
|
def make_shell_context():
|
|
return {'db': db, 'User': User, 'Role': Role, 'Permission': Permission, 'Department': Department, 'RoleField': RoleField}
|