From db4fd4525eca90e06095c1f01db5f6fe9f736206 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Wed, 22 Apr 2020 11:17:17 -0400 Subject: [PATCH] Don't explicitly set the email backend in production.py We shouldn't be explicitly setting this here. It's already set in all of our override files and not everyone who wants to use production.py wants to use SES so we shouldn't hardcode it here. Also move the other settings to above the config loading so that all config can be overridden by the config file. --- cms/envs/production.py | 30 +++++++++++++++--------------- lms/envs/production.py | 32 ++++++++++++++++---------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/cms/envs/production.py b/cms/envs/production.py index b981ff41dc..411125e239 100644 --- a/cms/envs/production.py +++ b/cms/envs/production.py @@ -33,6 +33,21 @@ def get_env_setting(setting): error_msg = u"Set the %s env variable" % setting raise ImproperlyConfigured(error_msg) +############### ALWAYS THE SAME ################################ + +DEBUG = False + +SESSION_ENGINE = 'django.contrib.sessions.backends.cache' + +# IMPORTANT: With this enabled, the server must always be behind a proxy that +# strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise, +# a user can fool our server into thinking it was an https connection. +# See +# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header +# for other warnings. +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +############### END ALWAYS THE SAME ################################ + # A file path to a YAML file from which to load all the configuration for the edx platform CONFIG_FILE = get_env_setting('STUDIO_CFG') @@ -90,21 +105,6 @@ CONFIG_ROOT = path(os.environ.get('CONFIG_ROOT', ENV_ROOT)) # prefix. CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else "" -############### ALWAYS THE SAME ################################ - -DEBUG = False - -EMAIL_BACKEND = 'django_ses.SESBackend' -SESSION_ENGINE = 'django.contrib.sessions.backends.cache' - -# IMPORTANT: With this enabled, the server must always be behind a proxy that -# strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise, -# a user can fool our server into thinking it was an https connection. -# See -# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header -# for other warnings. -SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') - ###################################### CELERY ################################ # Don't use a connection pool, since connections are dropped by ELB. diff --git a/lms/envs/production.py b/lms/envs/production.py index c5af7dce8c..9fae06000d 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -45,6 +45,22 @@ def get_env_setting(setting): error_msg = u"Set the %s env variable" % setting raise ImproperlyConfigured(error_msg) +################################ ALWAYS THE SAME ############################## + +DEBUG = False +DEFAULT_TEMPLATE_ENGINE['OPTIONS']['debug'] = False + +SESSION_ENGINE = 'django.contrib.sessions.backends.cache' + +# IMPORTANT: With this enabled, the server must always be behind a proxy that +# strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise, +# a user can fool our server into thinking it was an https connection. +# See +# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header +# for other warnings. +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +################################ END ALWAYS THE SAME ############################## + # A file path to a YAML file from which to load all the configuration for the edx platform CONFIG_FILE = get_env_setting('LMS_CFG') @@ -102,22 +118,6 @@ CONFIG_ROOT = path(os.environ.get('CONFIG_ROOT', ENV_ROOT)) # prefix. CONFIG_PREFIX = SERVICE_VARIANT + "." if SERVICE_VARIANT else "" -################################ ALWAYS THE SAME ############################## - -DEBUG = False -DEFAULT_TEMPLATE_ENGINE['OPTIONS']['debug'] = False - -EMAIL_BACKEND = 'django_ses.SESBackend' -SESSION_ENGINE = 'django.contrib.sessions.backends.cache' - -# IMPORTANT: With this enabled, the server must always be behind a proxy that -# strips the header HTTP_X_FORWARDED_PROTO from client requests. Otherwise, -# a user can fool our server into thinking it was an https connection. -# See -# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header -# for other warnings. -SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') - ###################################### CELERY ################################ # Don't use a connection pool, since connections are dropped by ELB.