17
back/app.py
17
back/app.py
@ -92,20 +92,7 @@ def create_app():
|
||||
app.get_db = get_db
|
||||
|
||||
# 启用 CORS(跨域支持)
|
||||
CORS(app,
|
||||
resources={r"/*": {
|
||||
"origins": [
|
||||
"http://localhost:8080",
|
||||
"http://127.0.0.1:8080",
|
||||
"http://[::1]:8080",
|
||||
"http://localhost:5173",
|
||||
"http://127.0.0.1:5173",
|
||||
"http://[::1]:5173"
|
||||
],
|
||||
"supports_credentials": True,
|
||||
"allow_headers": ["Content-Type", "Authorization"],
|
||||
"methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
||||
}})
|
||||
CORS(app, resources={r"/*": {"origins": "*"}}) # 允许所有来源,或指定局域网IP
|
||||
|
||||
# 注册蓝图
|
||||
from blueprints.login import bp as login_bp
|
||||
@ -165,4 +152,4 @@ def create_app():
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = create_app()
|
||||
app.run(debug=True)
|
||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
||||
Reference in New Issue
Block a user