init
This commit is contained in:
36
app.py
Normal file
36
app.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import os
|
||||
from flask import Flask
|
||||
from config import Config
|
||||
from models import init_app
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(Config)
|
||||
|
||||
# 初始化数据库
|
||||
init_app(app)
|
||||
|
||||
# 注册蓝图
|
||||
from routes.auth import auth_bp
|
||||
from routes.main import main_bp
|
||||
from routes.site import site_bp
|
||||
from routes.qbittorrent import qbittorrent_bp
|
||||
from routes.transmission import transmission_bp
|
||||
from routes.user import user_bp
|
||||
from routes.settings import settings_bp
|
||||
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(main_bp)
|
||||
app.register_blueprint(site_bp)
|
||||
app.register_blueprint(qbittorrent_bp)
|
||||
app.register_blueprint(transmission_bp)
|
||||
app.register_blueprint(user_bp)
|
||||
app.register_blueprint(settings_bp)
|
||||
|
||||
return app
|
||||
|
||||
# 创建应用实例供Gunicorn使用
|
||||
app = create_app()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0', port=5000)
|
||||
Reference in New Issue
Block a user