28 lines
642 B
Python
28 lines
642 B
Python
|
import logging as log
|
||
|
from config import conf, STATIC_DIR
|
||
|
import uvicorn
|
||
|
from fastapi import FastAPI
|
||
|
from fastapi.responses import ORJSONResponse
|
||
|
from starlette.staticfiles import StaticFiles
|
||
|
from routers import router
|
||
|
|
||
|
main_app = FastAPI(
|
||
|
default_response_class=ORJSONResponse,
|
||
|
docs_url=None,
|
||
|
)
|
||
|
|
||
|
main_app.include_router(router)
|
||
|
|
||
|
main_app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
log.info("Starting server")
|
||
|
uvicorn.run(
|
||
|
"main:main_app",
|
||
|
host=conf.run.host,
|
||
|
port=conf.run.port,
|
||
|
reload=conf.run.reload,
|
||
|
)
|
||
|
log.info("Server stopped")
|