Sfoglia il codice sorgente

[lib] Make sure cors setting can work with Python 2 (#1982)

Romain Rigaux 4 anni fa
parent
commit
914ff93e68
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      desktop/core/src/desktop/settings.py

+ 2 - 1
desktop/core/src/desktop/settings.py

@@ -360,9 +360,10 @@ EMAIL_SUBJECT_PREFIX = 'Hue %s - ' % desktop.conf.CLUSTER_ID.get()
 # Permissive CORS
 if desktop.conf.CORS_ENABLED.get():
   INSTALLED_APPS.append('corsheaders')
-  MIDDLEWARE.append('corsheaders.middleware.CorsMiddleware')
+  MIDDLEWARE.insert(0, 'corsheaders.middleware.CorsMiddleware')
   MIDDLEWARE.remove('django.middleware.csrf.CsrfViewMiddleware')
   CORS_ALLOW_ALL_ORIGINS = True
+  CORS_ORIGIN_ALLOW_ALL = True  # Old Py2 way
 
 # Configure database
 if os.getenv('DESKTOP_DB_CONFIG'):