| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | from concurrent.futures import ThreadPoolExecutorimport uvicornfrom fastapi import FastAPIfrom fastapi.middleware.cors import CORSMiddlewarefrom loguru import loggerfrom routers import get_related_wordsfrom routers import script_configfrom routers import tengxunyun_serverlogger.remove()  # 删去 import logger之后自动产生的handler,不删除的话会出现重复输出的现象logger.add("/data/pythonProject/video_to_word/logs/main_server.{time:YYYY-MM-DD}.log",           rotation="00:00",           format="{time:YYYY-MM-DD HH:mm:ss,SSS} [{process}] [{thread}] {level} {file} {line} - {message}",           level="INFO")threadPool = ThreadPoolExecutor(max_workers=4)app = FastAPI()origins = [    "http://192.168.0.195:9001",    "http://192.168.6.220:3000",    "http://192.168.1.34",    "http://192.168.1.34:8000",    "http://192.168.1.105",    "http://192.168.1.105:3000",    "http://111.206.86.186",    "http://111.206.86.186:3000",    "http://adsp.tjyourong.com.cn",    "http://adsp.tjyourong.com.cn:3000",    "http://adsp.c-top.com.cn",    "http://adsp.c-top.com.cn:3000"]app.add_middleware(    CORSMiddleware,    allow_origins=origins,    allow_credentials=True,    allow_methods=["*"],    allow_headers=["*"],)app.include_router(get_related_words.router)app.include_router(tengxunyun_server.router)app.include_router(script_config.router)if __name__ == '__main__':    uvicorn.run(app='main:app', host="0.0.0.0", port=31013, reload=True, debug=True)# gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker #线上启动命令
 |