This commit is contained in:
beabigegg
2025-09-12 08:54:21 +08:00
parent a2f024704c
commit 5ad4035e02
8 changed files with 246 additions and 364 deletions

View File

@@ -2,6 +2,7 @@ import os
import logging
from datetime import datetime
from flask import Flask, jsonify, send_from_directory, send_file, request
from werkzeug.middleware.proxy_fix import ProxyFix
from flask_cors import CORS
from flask_jwt_extended import JWTManager
from jwt.exceptions import InvalidTokenError
@@ -95,6 +96,9 @@ def create_app(config_name=None):
else:
return jsonify({'error': 'Not Found'}), 404
# Trust proxy headers (for nginx)
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1)
# Register error handlers
register_error_handlers(app)
@@ -182,4 +186,4 @@ app = create_app()
if __name__ == '__main__':
debug_mode = os.environ.get('FLASK_ENV') == 'development'
app.run(host='0.0.0.0', port=12011, debug=debug_mode)
app.run(host='0.0.0.0', port=12011, debug=debug_mode)