1 Star 0 Fork 0

bitterteaer/303-management-system

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.py 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
bitterteaer 提交于 2023-09-07 23:48 . 添加dockerfile
from flask import g, Flask, url_for, redirect, request, render_template, session
from flask_migrate import Migrate
from exts import db
from decorations import login_required
from models import User
import config
from blueprints.user import bp as user_bp
from blueprints.device import bp as device_bp
from blueprints.data import bp as data_bp
from blueprints.register_requests import bp as register_requests_bp
from blueprints.big_data import bp as big_data_bp
app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)
app.register_blueprint(user_bp)
app.register_blueprint(device_bp)
app.register_blueprint(data_bp)
app.register_blueprint(register_requests_bp)
app.register_blueprint(big_data_bp)
migrate = Migrate(app, db)
@app.before_request
def before_request():
id_user = session.get("id_user")
if id_user:
try:
user = User.query.get(id_user)
g.user = user
except:
g.user = None
@app.route("/")
@login_required
def index():
return redirect(url_for('static', filename='layui/examples/layout-admin.html'))
if __name__ == '__main__':
app.run(
port=5001,
host="0.0.0.0"
)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bitterteaer/303-management-system.git
git@gitee.com:bitterteaer/303-management-system.git
bitterteaer
303-management-system
303-management-system
master

搜索帮助