Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
Adds CORS headers
Browse files Browse the repository at this point in the history
  • Loading branch information
cuducos committed Apr 20, 2020
1 parent 10eca39 commit 8a6a2c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license = "GPL-3.0"
python = "^3.7"
dj_database_url = "^0.5.0"
django = "^3.0.5"
django-cors-headers = "^3.2.1"
django-extensions = "^2.2.9"
gunicorn = "^20.0.4"
psycopg2-binary = "^2.8.5"
Expand Down
8 changes: 8 additions & 0 deletions web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"django_extensions",
"corsheaders",
"web.core.apps.CoreConfig",
"web.api",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"corsheaders.middleware.CorsMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
Expand Down Expand Up @@ -116,3 +118,9 @@
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
STATIC_URL = "/static/"
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"


# Django CORS headers
# https://github.com/adamchainz/django-cors-headers

CORS_URLS_REGEX = r'^/api/.*$'

0 comments on commit 8a6a2c4

Please sign in to comment.