ob-repository-synchronize/main.py

32 lines
902 B
Python

# coding: utf-8
import uvicorn
import src.api.Cerobot
import src.api.Sync
import src.api.Account
import src.api.PullRequest
import src.api.User
import src.api.Log
import src.api.Auth
from extras.obfastapi.frame import OBFastAPI
from src.router import CE_ROBOT, PROJECT, JOB, ACCOUNT, PULL_REQUEST, USER, LOG, AUTH
from fastapi.staticfiles import StaticFiles
app = OBFastAPI()
app.include_router(CE_ROBOT)
app.include_router(PROJECT)
app.include_router(JOB)
app.include_router(ACCOUNT)
app.include_router(PULL_REQUEST)
app.include_router(USER)
app.include_router(LOG)
app.include_router(AUTH)
app.mount("/", StaticFiles(directory="web/dist"), name="static")
if __name__ == '__main__':
# workers 参数仅在命令行使用uvicorn启动时有效 或使用环境变量 WEB_CONCURRENCY
uvicorn.run(app='main:app', host='0.0.0.0', port=8000,
reload=True, debug=True, workers=2)