File size: 1,184 Bytes
1c1e321 a00f760 24a53c2 1c1e321 a00f760 1c1e321 a00f760 24a53c2 baad565 2d11fe8 24a53c2 3872812 45ed23c 2d11fe8 acec0b9 2d11fe8 baad565 24a53c2 baad565 ce8d7d5 baad565 51a46cc baad565 085d4b8 baad565 6acfb33 1366c85 1c1e321 d65b1bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
from fastapi import FastAPI, BackgroundTasks
from .Editor.editorRoutes import videditor_router
from App import bot
from App.utilis import WorkerClient, SERVER_STATE
from .Generate.generatorRoutes import (
generator_router,
database,
models,
)
import uuid
app = FastAPI()
manager = WorkerClient()
@app.on_event("startup")
async def startup_event():
app.state.db = database
app.state.models = models
try:
print("creating tables")
# print(type(database.url), database_url)
await models.create_all()
await models._create_all(str(database.url))
print("created")
except Exception as e:
print("failed to create",e)
finally:
print(database.is_connected)
if not database.is_connected:
await database.connect()
# await database.execute("pragma journal_mode=wal;")
# await bot.start()
# if SERVER_STATE.MASTER:
# response = await manager.register_worker()
# if not response:
# print("Error registering worker")
@app.get("/")
def read_root():
return {"Hello": "World"}
app.include_router(videditor_router)
app.include_router(generator_router)
|