perf: 使用MVC模式
This commit is contained in:
parent
9f10c1727d
commit
bdb665cf47
|
|
@ -11,7 +11,7 @@ from fastapi import FastAPI
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
from tortoise.contrib.fastapi import register_tortoise
|
from tortoise.contrib.fastapi import register_tortoise
|
||||||
|
|
||||||
from core.config import settings
|
from common.config import settings
|
||||||
|
|
||||||
sentry_sdk.init(settings.SENTRY_DSN)
|
sentry_sdk.init(settings.SENTRY_DSN)
|
||||||
|
|
||||||
24
main.py
24
main.py
|
|
@ -1,24 +0,0 @@
|
||||||
from fastapi import FastAPI
|
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
|
||||||
|
|
||||||
from utils import register_orm, register_redis
|
|
||||||
from utils import register_middleware
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
app.add_middleware(
|
|
||||||
CORSMiddleware,
|
|
||||||
allow_origins=["*"],
|
|
||||||
allow_credentials=True,
|
|
||||||
allow_methods=["*"],
|
|
||||||
allow_headers=["*"],
|
|
||||||
)
|
|
||||||
|
|
||||||
register_middleware(app)
|
|
||||||
register_orm(app)
|
|
||||||
register_redis(app)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import uvicorn
|
|
||||||
uvicorn.run("main:app", reload=True)
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
aerich==0.6.1
|
aerich==0.6.1
|
||||||
aiomysql==0.0.22
|
aiomysql==0.0.22
|
||||||
aioredis==2.0.1
|
aioredis==2.0.1
|
||||||
|
aiosmtpd==1.4.2
|
||||||
aiosqlite==0.17.0
|
aiosqlite==0.17.0
|
||||||
anyio==3.4.0
|
anyio==3.4.0
|
||||||
asgiref==3.4.1
|
asgiref==3.4.1
|
||||||
async-timeout==4.0.2
|
async-timeout==4.0.2
|
||||||
|
atpublic==2.3
|
||||||
|
attrs==21.4.0
|
||||||
bcrypt==3.2.0
|
bcrypt==3.2.0
|
||||||
certifi==2021.10.8
|
certifi==2021.10.8
|
||||||
cffi==1.15.0
|
cffi==1.15.0
|
||||||
|
|
@ -17,6 +20,7 @@ fastapi==0.70.1
|
||||||
h11==0.12.0
|
h11==0.12.0
|
||||||
idna==3.3
|
idna==3.3
|
||||||
iso8601==0.1.16
|
iso8601==0.1.16
|
||||||
|
loguru==0.5.3
|
||||||
passlib==1.7.4
|
passlib==1.7.4
|
||||||
pyasn1==0.4.8
|
pyasn1==0.4.8
|
||||||
pycparser==2.21
|
pycparser==2.21
|
||||||
|
|
@ -37,3 +41,4 @@ tortoise-orm==0.17.8
|
||||||
typing_extensions==4.0.1
|
typing_extensions==4.0.1
|
||||||
urllib3==1.26.7
|
urllib3==1.26.7
|
||||||
uvicorn==0.16.0
|
uvicorn==0.16.0
|
||||||
|
win32-setctime==1.0.4
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue