diff --git a/Dockerfile b/Dockerfile index 7ce4b5c..1c36481 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,9 @@ COPY ./VERSION /app RUN pip install --no-cache-dir -r requirements.txt COPY ./app /app/app +ENV API_KEYS='["your_api_key_1"]' +ENV ALLOWED_TOKENS='["your_token_1"]' +ENV TZ='Asia/Shanghai' # Expose port EXPOSE 8000 diff --git a/app/exception/exceptions.py b/app/exception/exceptions.py index b951c03..9c8f99a 100644 --- a/app/exception/exceptions.py +++ b/app/exception/exceptions.py @@ -130,11 +130,6 @@ def setup_exception_handlers(app: FastAPI) -> None: """处理通用异常""" logger.exception(f"Unhandled Exception: {str(exc)}") return JSONResponse( - status_code=exc.args[0], - content={ - "error": { - "code": exc.args[0], - "message": exc.args[1], - } - }, + status_code=500, + content=str(exc), ) diff --git a/app/router/routes.py b/app/router/routes.py index 03848f6..4ba4865 100644 --- a/app/router/routes.py +++ b/app/router/routes.py @@ -24,10 +24,13 @@ from app.router import ( ) from app.service.key.key_manager import get_key_manager_instance from app.service.stats.stats_service import StatsService +from app.utils.static_version import get_static_url logger = get_routes_logger() templates = Jinja2Templates(directory="app/templates") +# 设置模板全局变量 +templates.env.globals["static_url"] = get_static_url def setup_routers(app: FastAPI) -> None: diff --git a/app/templates/auth.html b/app/templates/auth.html index efebedf..9e1d058 100644 --- a/app/templates/auth.html +++ b/app/templates/auth.html @@ -51,7 +51,7 @@