[libs] Apply CORS setting according to the Python version
@@ -362,8 +362,10 @@ if desktop.conf.CORS_ENABLED.get():
INSTALLED_APPS.append('corsheaders')
MIDDLEWARE.insert(0, 'corsheaders.middleware.CorsMiddleware')
MIDDLEWARE.remove('django.middleware.csrf.CsrfViewMiddleware')
+ if sys.version_info[0] > 2:
CORS_ALLOW_ALL_ORIGINS = True
- CORS_ORIGIN_ALLOW_ALL = True # Old Py2 way
+ else:
+ CORS_ORIGIN_ALLOW_ALL = True
# Configure database
if os.getenv('DESKTOP_DB_CONFIG'):
