From e398236f4126a52e8d9759907a0c2739843060e7 Mon Sep 17 00:00:00 2001 From: meua Date: Fri, 15 Dec 2023 13:52:59 +0800 Subject: [PATCH] add: CORS_ALLOW_METHODS and CORS_ALLOW_HEADERS --- settings/prod.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/settings/prod.py b/settings/prod.py index fbf5d2676b..aedcf04cdb 100755 --- a/settings/prod.py +++ b/settings/prod.py @@ -10,14 +10,36 @@ # Database # https://docs.djangoproject.com/en/1.10.2/ref/settings/#databases -CORS_ORIGIN_ALLOW_ALL = True +CORS_ALLOW_ALL_ORIGINS = True -CORS_ORIGIN_WHITELIST = ( +CORS_ALLOWED_ORIGINS = ( "https://arena.s3.cn-northwest-1.amazonaws.com.cn", "http://arena.synkrotron.ai", "http://beta.synkrotron.ai", ) +CORS_ALLOW_METHODS = [ + 'DELETE', + 'GET', + 'OPTIONS', + 'PATCH', + 'POST', + 'PUT', +] + +CORS_ALLOW_HEADERS = [ + 'accept', + 'accept-encoding', + 'authorization', + 'content-type', + 'dnt', + 'origin', + 'user-agent', + 'x-csrftoken', + 'x-requested-with', + 'noMessage', +] + DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2",