-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
46 lines (37 loc) · 1.46 KB
/
app.py
File metadata and controls
46 lines (37 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from flask import Flask
from flask_cors import CORS
from config import Config
from models import db
def create_app():
"""创建Flask应用实例"""
app = Flask(__name__)
app.config.from_object(Config)
# 初始化数据库
db.init_app(app)
# 启用CORS
CORS(app)
# 注册蓝图
from controllers.user_controller import user_bp
from controllers.warehouse_controller import warehouse_bp
from controllers.supplier_controller import supplier_bp
from controllers.product_controller import product_bp
from controllers.stock_controller import stock_bp
from controllers.inbound_controller import inbound_bp
from controllers.outbound_controller import outbound_bp
from controllers.report_controller import report_bp
app.register_blueprint(user_bp, url_prefix='/api/users')
app.register_blueprint(warehouse_bp, url_prefix='/api/warehouses')
app.register_blueprint(supplier_bp, url_prefix='/api/suppliers')
app.register_blueprint(product_bp, url_prefix='/api/products')
app.register_blueprint(stock_bp, url_prefix='/api/stocks')
app.register_blueprint(inbound_bp, url_prefix='/api/inbound')
app.register_blueprint(outbound_bp, url_prefix='/api/outbound')
app.register_blueprint(report_bp, url_prefix='/api/reports')
return app
if __name__ == '__main__':
app = create_app()
app.run(
host=Config.SERVER_HOST,
port=Config.SERVER_PORT,
debug=True
)