add CORS
This commit is contained in:
@@ -30,6 +30,7 @@ DEBUG = cfg_dev_mode
|
|||||||
ALLOWED_HOSTS = ["rh.ambulance-clerc.ch"]
|
ALLOWED_HOSTS = ["rh.ambulance-clerc.ch"]
|
||||||
if cfg_dev_mode:
|
if cfg_dev_mode:
|
||||||
ALLOWED_HOSTS.append("127.0.0.1")
|
ALLOWED_HOSTS.append("127.0.0.1")
|
||||||
|
ALLOWED_HOSTS.append("33.144.144.2")
|
||||||
CSRF_TRUSTED_ORIGINS = ['https://rh.ambulance-clerc.ch']
|
CSRF_TRUSTED_ORIGINS = ['https://rh.ambulance-clerc.ch']
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +57,8 @@ INSTALLED_APPS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
INSTALLED_APPS += ( 'apilog.apps.ApilogConfig',)
|
INSTALLED_APPS += ( 'apilog.apps.ApilogConfig',)
|
||||||
|
INSTALLED_APPS += ( 'corsheaders',)
|
||||||
|
'',
|
||||||
|
|
||||||
#Ajout de rest_framework
|
#Ajout de rest_framework
|
||||||
INSTALLED_APPS += ('rest_framework', 'rest_framework.authtoken',)
|
INSTALLED_APPS += ('rest_framework', 'rest_framework.authtoken',)
|
||||||
@@ -116,6 +119,7 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 2500
|
|||||||
|
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
'corsheaders.middleware.CorsMiddleware',
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
@@ -129,8 +133,13 @@ MIDDLEWARE = [
|
|||||||
'django.middleware.locale.LocaleMiddleware',
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
"http://33.144.144.2:5173", # Ajoutez ici l'URL de votre application frontend ,
|
||||||
|
]
|
||||||
|
|
||||||
MIDDLEWARE += ('apilog.middleware.APILogMiddleware',)
|
MIDDLEWARE += ('apilog.middleware.APILogMiddleware',)
|
||||||
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'Reskreen.urls'
|
ROOT_URLCONF = 'Reskreen.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
|
BIN
db.sqlite3
Normal file
BIN
db.sqlite3
Normal file
Binary file not shown.
Reference in New Issue
Block a user