Add django-cors-headers
Django CI/CD / build-and-push (pull_request) Has been cancelled Details

This commit is contained in:
Lukáš Kucharczyk 2023-01-25 17:48:17 +01:00
parent 52881a88c6
commit d6f77c0c19
3 changed files with 17 additions and 1 deletions

2
poetry.lock generated
View File

@ -994,4 +994,4 @@ watchdog = ["watchdog (>=2.3)"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "4ca6b31c654012f0d2b72bd44d3f40d986b183d6dd731c3a2aaed9a733032c08" content-hash = "7a7ba3831802cf91b722b956817a0606b7b8f97724b1a23e5e581657fb34ea19"

View File

@ -15,6 +15,7 @@ uvicorn = "^0.20.0"
pandas = "^1.5.2" pandas = "^1.5.2"
matplotlib = "^3.6.3" matplotlib = "^3.6.3"
django-rest-framework = "^0.1.0" django-rest-framework = "^0.1.0"
django-cors-headers = "^3.13.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = "^22.12.0" black = "^22.12.0"

View File

@ -160,3 +160,18 @@ REST_FRAMEWORK = {
"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly" "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly"
] ]
} }
FRONTEND_ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", "frontend", "dist"))
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOW_HEADERS = list(default_headers) + [
"Accept-Language",
"Connection",
"Host",
"Origin",
"Referer",
"Sec-Fetch-Dest",
"Sec-Fetch-Mode",
"Sec-Fetch-Site",
]