From 36094276ea1e4da49e35587c4c08a7900e593e91 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Thu, 14 Nov 2024 07:23:12 +0100 Subject: [PATCH] fixes --- app/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index 9931944..b9cafc3 100644 --- a/app/main.py +++ b/app/main.py @@ -15,12 +15,10 @@ from fastapi import FastAPI from fastapi.requests import Request from jose import jws, jwk, jwt, JWTError from jose.constants import ALGORITHMS -from starlette.middleware.cors import CORSMiddleware -from starlette.responses import StreamingResponse, JSONResponse, Response, RedirectResponse from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from starlette.middleware.cors import CORSMiddleware -from starlette.responses import StreamingResponse, JSONResponse as JSONr, HTMLResponse as HTMLr, Response, RedirectResponse +from starlette.responses import StreamingResponse, JSONResponse as JSONr, Response, RedirectResponse from starlette.staticfiles import StaticFiles from starlette.templating import Jinja2Templates @@ -91,8 +89,8 @@ async def lifespan(_: FastAPI): config = dict(openapi_url=None, docs_url=None, redoc_url=None) # dict(openapi_url='/-/openapi.json', docs_url='/-/docs', redoc_url='/-/redoc') app = FastAPI(title='FastAPI-DLS', description='Minimal Delegated License Service (DLS).', version=VERSION, lifespan=lifespan, **config) -app.mount('/static', StaticFiles(directory='static', html=True), name='static'), -templates = Jinja2Templates(directory='templates') +app.mount('/static', StaticFiles(directory=join(dirname(__file__), 'static'), html=True), name='static'), +templates = Jinja2Templates(directory=join(dirname(__file__), 'templates')) app.debug = DEBUG app.add_middleware( @@ -133,6 +131,8 @@ def __json_config() -> dict: } +# Endpoints + @app.get('/', summary='* Index') async def index(): return RedirectResponse('/-/')