diff --git a/app/main.py b/app/main.py index 3bbb784..ac060c3 100644 --- a/app/main.py +++ b/app/main.py @@ -17,7 +17,8 @@ from starlette.middleware import Middleware from starlette_context import context, plugins from starlette_context.middleware import RawContextMiddleware -if os.path.isfile("first_run"): +if os.path.isfile("first_run") and os.environ.get("RELOAD_ON_FIRST_RUN"): + print("First run ... load data") with SessionLocal() as db: asyncio.run(admin.create_upload_file(include_non_singable=True, db=db)) os.remove("first_run") diff --git a/app/routers/admin.py b/app/routers/admin.py index 83beaa7..fd845c8 100644 --- a/app/routers/admin.py +++ b/app/routers/admin.py @@ -68,10 +68,13 @@ def get_spotify_id(url): @router.post("/load_list") async def create_upload_file(include_non_singable: bool = False, db: Session = Depends(get_db)): + print("load list") Base.metadata.drop_all(engine) Base.metadata.create_all(engine) song_list = pd.read_excel(os.environ['LIST_URL']) + + print(song_list) song_list = song_list.replace({np.nan: None}) song_list = song_list.replace({"n/a": None})