Commit 86ae68b7 by Clinton Blackburn

Updated Settings

- Cleaned template settings, taking advantage of Django 1.8 changes
- Removed unnecessary permissions scope from OIDC login requests
- Moved get_lms_url to ecommerce.settings module

ECOM-2178
parent 3ce4d09e
...@@ -5,7 +5,7 @@ from django.conf import settings ...@@ -5,7 +5,7 @@ from django.conf import settings
import requests import requests
from ecommerce.courses.utils import mode_for_seat from ecommerce.courses.utils import mode_for_seat
from ecommerce.settings.base import get_lms_url from ecommerce.settings import get_lms_url
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -13,7 +13,7 @@ from testfixtures import LogCapture ...@@ -13,7 +13,7 @@ from testfixtures import LogCapture
from ecommerce.courses.models import Course from ecommerce.courses.models import Course
from ecommerce.courses.publishers import LMSPublisher from ecommerce.courses.publishers import LMSPublisher
from ecommerce.extensions.catalogue.tests.mixins import CourseCatalogTestMixin from ecommerce.extensions.catalogue.tests.mixins import CourseCatalogTestMixin
from ecommerce.settings.base import get_lms_url from ecommerce.settings import get_lms_url
EDX_API_KEY = 'edx' EDX_API_KEY = 'edx'
......
...@@ -8,7 +8,7 @@ from ecommerce.courses.utils import mode_for_seat ...@@ -8,7 +8,7 @@ from ecommerce.courses.utils import mode_for_seat
from ecommerce.extensions.analytics.utils import is_segment_configured, parse_tracking_context, log_exceptions from ecommerce.extensions.analytics.utils import is_segment_configured, parse_tracking_context, log_exceptions
from ecommerce.extensions.checkout.utils import get_provider_data from ecommerce.extensions.checkout.utils import get_provider_data
from ecommerce.notifications.notifications import send_notification from ecommerce.notifications.notifications import send_notification
from ecommerce.settings.base import get_lms_url from ecommerce.settings import get_lms_url
from oscar.core.loading import get_class from oscar.core.loading import get_class
......
...@@ -9,7 +9,7 @@ from waffle.models import Switch ...@@ -9,7 +9,7 @@ from waffle.models import Switch
from ecommerce.courses.models import Course from ecommerce.courses.models import Course
from ecommerce.extensions.catalogue.tests.mixins import CourseCatalogTestMixin from ecommerce.extensions.catalogue.tests.mixins import CourseCatalogTestMixin
from ecommerce.extensions.checkout.signals import send_course_purchase_email from ecommerce.extensions.checkout.signals import send_course_purchase_email
from ecommerce.settings.base import get_lms_url from ecommerce.settings import get_lms_url
class SignalTests(CourseCatalogTestMixin, TestCase): class SignalTests(CourseCatalogTestMixin, TestCase):
......
...@@ -6,7 +6,7 @@ import requests ...@@ -6,7 +6,7 @@ import requests
from requests import ConnectionError, Timeout from requests import ConnectionError, Timeout
from ecommerce.extensions.checkout.utils import get_provider_data from ecommerce.extensions.checkout.utils import get_provider_data
from ecommerce.settings.base import get_lms_url from ecommerce.settings import get_lms_url
@ddt.ddt @ddt.ddt
......
...@@ -3,7 +3,7 @@ import requests ...@@ -3,7 +3,7 @@ import requests
from django.conf import settings from django.conf import settings
from ecommerce.settings.base import get_lms_url from ecommerce.settings import get_lms_url
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
from urlparse import urljoin
def get_lms_url(path):
from django.conf import settings
return urljoin(settings.LMS_URL_ROOT, path)
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
import os import os
from os.path import basename, normpath from os.path import basename, normpath
from sys import path from sys import path
from urlparse import urljoin
from django.conf import settings
from oscar import OSCAR_MAIN_TEMPLATE_DIR from oscar import OSCAR_MAIN_TEMPLATE_DIR
from ecommerce.settings._oscar import * from ecommerce.settings._oscar import *
...@@ -29,9 +27,6 @@ path.append(DJANGO_ROOT) ...@@ -29,9 +27,6 @@ path.append(DJANGO_ROOT)
# DEBUG CONFIGURATION # DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug # See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = False DEBUG = False
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
# END DEBUG CONFIGURATION # END DEBUG CONFIGURATION
...@@ -150,40 +145,37 @@ FIXTURE_DIRS = ( ...@@ -150,40 +145,37 @@ FIXTURE_DIRS = (
# TEMPLATE CONFIGURATION # TEMPLATE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
TEMPLATE_CONTEXT_PROCESSORS = ( TEMPLATES = [
'django.contrib.auth.context_processors.auth', {
'django.core.context_processors.debug', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'django.core.context_processors.i18n', 'APP_DIRS': True,
'django.core.context_processors.media', 'DIRS': (
'django.core.context_processors.static', normpath(join(DJANGO_ROOT, 'templates')),
'django.core.context_processors.tz', # Templates which override default Oscar templates
'django.contrib.messages.context_processors.messages', normpath(join(DJANGO_ROOT, 'templates/oscar')),
'django.core.context_processors.request', OSCAR_MAIN_TEMPLATE_DIR,
'oscar.apps.search.context_processors.search_form', ),
'oscar.apps.promotions.context_processors.promotions', 'OPTIONS': {
'oscar.apps.checkout.context_processors.checkout', 'context_processors': (
'oscar.apps.customer.notifications.context_processors.notifications', 'django.contrib.auth.context_processors.auth',
'oscar.core.context_processors.metadata', 'django.template.context_processors.debug',
'ecommerce.core.context_processors.core', 'django.template.context_processors.i18n',
) 'django.template.context_processors.media',
'django.template.context_processors.static',
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders 'django.template.context_processors.tz',
TEMPLATE_LOADERS = ( 'django.contrib.messages.context_processors.messages',
'django.template.loaders.filesystem.Loader', 'django.template.context_processors.request',
'django.template.loaders.app_directories.Loader', 'oscar.apps.search.context_processors.search_form',
) 'oscar.apps.promotions.context_processors.promotions',
'oscar.apps.checkout.context_processors.checkout',
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs 'oscar.apps.customer.notifications.context_processors.notifications',
TEMPLATE_DIRS = ( 'oscar.core.context_processors.metadata',
normpath(join(DJANGO_ROOT, 'templates')), 'ecommerce.core.context_processors.core',
# Templates which override default Oscar templates ),
normpath(join(DJANGO_ROOT, 'templates/oscar')), 'debug': True, # Django will only display debug pages if the global DEBUG setting is set to True.
OSCAR_MAIN_TEMPLATE_DIR, }
) },
]
ALLOWED_INCLUDE_ROOTS = (
normpath(join(SITE_ROOT, 'templates')),
)
# END TEMPLATE CONFIGURATION # END TEMPLATE CONFIGURATION
...@@ -216,13 +208,6 @@ ECOMMERCE_URL_ROOT = None ...@@ -216,13 +208,6 @@ ECOMMERCE_URL_ROOT = None
# Absolute URL used to construct LMS URLs. # Absolute URL used to construct LMS URLs.
LMS_URL_ROOT = None LMS_URL_ROOT = None
def get_lms_url(path):
# This function accesses Django settings because other settings modules override
# LMS_URL_ROOT; we don't always want this function to use the value of LMS_URL_ROOT
# defined in this module.
return urljoin(settings.LMS_URL_ROOT, path)
# The location of the LMS heartbeat page # The location of the LMS heartbeat page
LMS_HEARTBEAT_URL = None LMS_HEARTBEAT_URL = None
...@@ -383,8 +368,6 @@ SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY = SOCIAL_AUTH_EDX_OIDC_SECRET ...@@ -383,8 +368,6 @@ SOCIAL_AUTH_EDX_OIDC_ID_TOKEN_DECRYPTION_KEY = SOCIAL_AUTH_EDX_OIDC_SECRET
# Redirect successfully authenticated users to the Oscar dashboard. # Redirect successfully authenticated users to the Oscar dashboard.
LOGIN_REDIRECT_URL = '/dashboard/' LOGIN_REDIRECT_URL = '/dashboard/'
EXTRA_SCOPE = ['permissions']
# END AUTHENTICATION # END AUTHENTICATION
......
...@@ -4,6 +4,7 @@ from __future__ import absolute_import ...@@ -4,6 +4,7 @@ from __future__ import absolute_import
import os import os
from os.path import join, normpath from os.path import join, normpath
from ecommerce.settings import get_lms_url
from ecommerce.settings.base import * from ecommerce.settings.base import *
from ecommerce.settings.logger import get_logger_config from ecommerce.settings.logger import get_logger_config
......
from __future__ import absolute_import from __future__ import absolute_import
import os from ecommerce.settings import get_lms_url
from ecommerce.settings.base import * from ecommerce.settings.base import *
from ecommerce.settings.logger import get_logger_config from ecommerce.settings.logger import get_logger_config
...@@ -30,6 +29,7 @@ class DisableMigrations(object): ...@@ -30,6 +29,7 @@ class DisableMigrations(object):
For more context, see http://goo.gl/Fr4qyE. For more context, see http://goo.gl/Fr4qyE.
""" """
def __contains__(self, item): def __contains__(self, item):
"""Make it appear as if all apps are contained in the dictionary.""" """Make it appear as if all apps are contained in the dictionary."""
return True return True
...@@ -38,6 +38,7 @@ class DisableMigrations(object): ...@@ -38,6 +38,7 @@ class DisableMigrations(object):
"""Force Django to look for migrations in a nonexistent package.""" """Force Django to look for migrations in a nonexistent package."""
return 'notmigrations' return 'notmigrations'
if str(os.environ.get('DISABLE_MIGRATIONS')) == 'True': if str(os.environ.get('DISABLE_MIGRATIONS')) == 'True':
MIGRATION_MODULES = DisableMigrations() MIGRATION_MODULES = DisableMigrations()
# END TEST SETTINGS # END TEST SETTINGS
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "edx-ecommerce", "name": "edx-ecommerce",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/edx/edx-ecommerce" "url": "git://github.com/edx/ecommerce"
}, },
"dependencies": { "dependencies": {
"bower": "^1.4.1", "bower": "^1.4.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment