2024-01-19 03:15:48 +03:00
|
|
|
import asyncio
|
2024-01-18 21:15:56 +03:00
|
|
|
import sys
|
|
|
|
|
|
|
|
import uvicorn
|
|
|
|
|
2024-01-19 03:15:48 +03:00
|
|
|
from fastfood.crud import create_db_and_tables
|
|
|
|
|
2024-01-18 21:15:56 +03:00
|
|
|
|
|
|
|
def run_app():
|
|
|
|
"""
|
|
|
|
Запуск
|
|
|
|
"""
|
|
|
|
uvicorn.run(
|
|
|
|
app="fastfood.app:create_app",
|
|
|
|
reload=True,
|
|
|
|
factory=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if "filldb" in sys.argv:
|
|
|
|
"""Наполнение БД демонстрационными данными"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
if "--run-server" in sys.argv:
|
2024-01-19 03:15:48 +03:00
|
|
|
async def create():
|
|
|
|
await create_db_and_tables()
|
|
|
|
asyncio.run(create())
|
2024-01-18 21:15:56 +03:00
|
|
|
run_app()
|