代码拉取完成,页面将自动刷新
#!/usr/bin/python
# -*- coding: utf-8 -*
from flask import Flask, render_template
from flask_wtf import CSRFProtect
from flask_session import Session
from config import config, HOST, PORT
from exts import db
from apps import adm_bp, adm_asset_bp, adm_bsm_bp, adm_equipment_bp
from apps import personal_bp, personal_work_order_bp
from apps import menu_bp, role_bp
from apps import system_bp
from apps import login_bp, user_bp, structure_bp
from apps.utils import get_menus
def makeapp():
app = Flask(__name__)
app.config.from_object(config)
# 蓝图注册
app.register_blueprint(adm_bp)
app.register_blueprint(adm_asset_bp)
app.register_blueprint(adm_bsm_bp)
app.register_blueprint(adm_equipment_bp)
app.register_blueprint(personal_bp)
app.register_blueprint(personal_work_order_bp)
app.register_blueprint(menu_bp)
app.register_blueprint(role_bp)
app.register_blueprint(system_bp)
app.register_blueprint(login_bp)
app.register_blueprint(user_bp)
app.register_blueprint(structure_bp)
# 开启csrf防护
csrf = CSRFProtect()
csrf.init_app(app)
# session
Session(app)
db.init_app(app)
@app.context_processor
def user_context_processor():
return {'user': get_menus.get_currentuser()}
@app.context_processor
def menu_context_processor():
return {'top_menu': get_menus.get_top_menu()}
@app.context_processor
def system_context_processor():
system_setup = get_menus.get_system_setup()
if system_setup:
return {'system_setup': get_menus.get_system_setup()}
else:
return {'system_setup': None}
@app.errorhandler(404)
def page_not_found(error):
return render_template('page404.html')
return app
app = makeapp()
if __name__ == '__main__':
app = makeapp()
app.run(host=HOST, port=PORT)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。