Переглянути джерело

move initital_data to sync mode

Clovis JAQUIN 2 роки тому
батько
коміт
43060e576e
1 змінених файлів з 3 додано та 7 видалено
  1. 3 7
      app/initial_data.py

+ 3 - 7
app/initial_data.py

@@ -5,8 +5,6 @@ It is included in `init.sh` script.
 By defualt `main` create a superuser if not exists
 """
 
-import asyncio
-
 from sqlalchemy import select
 
 from app.core import config, security
@@ -14,12 +12,10 @@ from app.core.session import session
 from app.models import User
 
 
-async def main() -> None:
+def main() -> None:
     print("Start initial data")
     with session() as db:
-        result = db.execute(
-            select(User).where(User.email == config.settings.FIRST_SUPERUSER_EMAIL)
-        )
+        result = db.execute(select(User).where(User.email == config.settings.FIRST_SUPERUSER_EMAIL))
         user = result.scalars().first()
 
         if user is None:
@@ -39,4 +35,4 @@ async def main() -> None:
 
 
 if __name__ == "__main__":
-    asyncio.run(main())
+    main()