1 Star 0 Fork 0

吴宇航/PythonServiceDeployment

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rpc_main.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
吴宇航 提交于 2024-03-04 14:47 +08:00 . 标题: 0304同步代码
from core import settings
settings.setup()
from common.errors import (
handler_validation_exception,
CMDError,
ServiceError,
handler_business_error,
handler_service_error,
handler_http_exception,
handler_server_rpc_error
)
from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError, HTTPException
from starlette.exceptions import HTTPException as StarletteHTTPException
from db.errors import BusinessError
from common.permission_util import RpcIsAuthenticatedMiddleware
from rpc_api.conda import conda_router
from rpc_api.nvm import nvm_router
API_PREFIX = '/rpc_api'
app = FastAPI(
title='PyDep',
description='PyDepAPI接口文档',
version='1.0.0',
exception_handlers={
RequestValidationError: handler_validation_exception,
HTTPException: handler_http_exception,
StarletteHTTPException: handler_http_exception,
BusinessError: handler_business_error,
CMDError: handler_business_error,
ServiceError: handler_service_error,
Exception: handler_server_rpc_error
},
)
app.add_middleware(RpcIsAuthenticatedMiddleware)
app.include_router(conda_router, prefix=API_PREFIX)
app.include_router(nvm_router, prefix=API_PREFIX)
if __name__ == '__main__':
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=2081)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuyuhang409_user/PythonServiceDeployment.git
git@gitee.com:wuyuhang409_user/PythonServiceDeployment.git
wuyuhang409_user
PythonServiceDeployment
PythonServiceDeployment
master

搜索帮助