瀏覽代碼

CORS Added

main
Madiwka 1 年之前
父節點
當前提交
374dc1c306
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. +1
    -1
      app/core/config.py
  2. +2
    -1
      app/main.py

+ 1
- 1
app/core/config.py 查看文件

@@ -3,7 +3,7 @@ class Settings:
PROJECT_VERSION: str = "1.0.0"
POSTGRES_USER: str = "VMSBase"
POSTGRES_PASSWORD = "VMSBasePass"
POSTGRES_SERVER: str = "db"
POSTGRES_SERVER: str = "localhost"
POSTGRES_PORT: str = "5432"
POSTGRES_DB: str = "VMSData"
DATABASE_URL = f"postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_SERVER}:{POSTGRES_PORT}/{POSTGRES_DB}"


+ 2
- 1
app/main.py 查看文件

@@ -3,6 +3,7 @@ from core.config import settings, createAdminAcc
from db.session import engine
from db.base import Base
from apis.base import api_router
from fastapi.middleware.cors import CORSMiddleware


def include_routes(app): # include all routes from our api/v1/
@@ -21,7 +22,7 @@ def startup(): # start the project, and create the tables


app = startup()
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"],)

# Testing stuff
@app.get("/")


Loading…
取消
儲存