2024-10-01 11:29:39 +00:00
|
|
|
import logging
|
2024-10-01 12:05:49 +00:00
|
|
|
from config import settings, STATIC_DIR
|
2024-10-01 11:29:39 +00:00
|
|
|
import uvicorn
|
2024-10-01 11:37:29 +00:00
|
|
|
from fastapi import FastAPI
|
|
|
|
from fastapi.responses import ORJSONResponse
|
2024-10-01 12:05:49 +00:00
|
|
|
from starlette.staticfiles import StaticFiles
|
2024-10-01 14:38:06 +00:00
|
|
|
from web.routers import router as web_router
|
2024-10-01 11:29:39 +00:00
|
|
|
|
2024-10-01 11:37:29 +00:00
|
|
|
main_app = FastAPI(
|
|
|
|
default_response_class=ORJSONResponse,
|
|
|
|
docs_url=None,
|
|
|
|
)
|
2024-10-01 14:09:19 +00:00
|
|
|
|
|
|
|
main_app.include_router(web_router)
|
|
|
|
|
2024-10-01 12:05:49 +00:00
|
|
|
|
|
|
|
main_app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|
2024-10-01 11:37:29 +00:00
|
|
|
|
|
|
|
|
2024-10-01 11:29:39 +00:00
|
|
|
if __name__ == "__main__":
|
2024-10-01 14:48:12 +00:00
|
|
|
logging.info("Starting server")
|
2024-10-01 11:29:39 +00:00
|
|
|
uvicorn.run(
|
|
|
|
"main:main_app",
|
|
|
|
host=settings.run.host,
|
|
|
|
port=settings.run.port,
|
|
|
|
reload=settings.run.reload,
|
|
|
|
)
|
2024-10-01 14:48:12 +00:00
|
|
|
logging.info("Server stopped")
|