Skip to content

Commit

Permalink
add CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHamed12 committed Apr 4, 2024
1 parent fb6fd52 commit 84d9aa2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions project/project/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,12 @@


}
### CORS HEADERS ###
CORS_ALLOW_HEADERS = ["*"]
CORS_ALLOW_ALL_ORIGINS = True
INSTALLED_APPS += [
'corsheaders',
]
MIDDLEWARE += [
'corsheaders.middleware.CorsMiddleware',
]
2 changes: 1 addition & 1 deletion project/project/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from decouple import config

db_config = dj_database_url.config(default=config("DATABASE_URL"))
db_config['ATOMIC_REQUESTS'] = True
# db_config['ATOMIC_REQUESTS'] = True
DATABASES = {
'default': db_config,
"TEST": {
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ asgiref==3.8.1
cfgv==3.4.0
distlib==0.3.8
Django==5.0.3
django-cors-headers==4.3.1
django-database-url==1.0.3
djangorestframework==3.15.1
djangorestframework-simplejwt==5.3.1
Expand Down

0 comments on commit 84d9aa2

Please # to comment.