cors
This commit is contained in:
parent
c953a820d1
commit
399e4216d4
9
main.py
9
main.py
|
|
@ -8,7 +8,7 @@ from tortoise.contrib.fastapi import register_tortoise
|
||||||
from app.api.redis_test import redis_test_router
|
from app.api.redis_test import redis_test_router
|
||||||
from app.api.translator import translator_router
|
from app.api.translator import translator_router
|
||||||
from app.utils import redis_client
|
from app.utils import redis_client
|
||||||
from settings import TORTOISE_ORM,ONLINE_SETTINGS
|
from settings import TORTOISE_ORM, ONLINE_SETTINGS
|
||||||
from app.api.users import users_router
|
from app.api.users import users_router
|
||||||
from app.api.admin.router import admin_router
|
from app.api.admin.router import admin_router
|
||||||
from app.api.search import dict_search
|
from app.api.search import dict_search
|
||||||
|
|
@ -33,12 +33,7 @@ import debug.httpdebugger
|
||||||
# 添加CORS中间件
|
# 添加CORS中间件
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=[
|
allow_origins=["*"],
|
||||||
"http://localhost:5173",
|
|
||||||
"http://localhost:5174",
|
|
||||||
"http://127.0.0.1:5173",
|
|
||||||
"http://127.0.0.1:5174",
|
|
||||||
],
|
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue