소스 검색

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

Romain Rigaux 5 년 전
부모
커밋
914ff93e68
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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'):