1 Star 0 Fork 0

yun5704/office_system

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
ubuntu 提交于 2020-04-01 23:00 . 云服务部署
#!/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)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/yun5704/office_system.git
git@gitee.com:yun5704/office_system.git
yun5704
office_system
office_system
master

搜索帮助