diff --git a/examples/chatserver/settings.py b/examples/chatserver/settings.py index fa17a31f..f059aa9a 100644 --- a/examples/chatserver/settings.py +++ b/examples/chatserver/settings.py @@ -1,12 +1,11 @@ # Django settings for unit test project. import os +from django import VERSION as DJANGO_VERSION BASE_DIR = os.path.dirname(os.path.dirname(__file__)) DEBUG = True -TEMPLATE_DEBUG = True - ALLOWED_HOSTS = [] DATABASES = { @@ -43,18 +42,6 @@ SESSION_REDIS_PREFIX = 'session' -TEMPLATE_CONTEXT_PROCESSORS = ( - 'django.contrib.auth.context_processors.auth', - 'django.core.context_processors.static', - 'django.core.context_processors.request', - 'ws4redis.context_processors.default', -) - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.app_directories.Loader', -) - # Internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ @@ -128,3 +115,35 @@ }, }, } + + +if DJANGO_VERSION < (1, 8): + TEMPLATE_DEBUG = True + + TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.static', + 'django.core.context_processors.request', + 'ws4redis.context_processors.default', + ) + + # List of callables that know how to import templates from various sources. + TEMPLATE_LOADERS = ( + 'django.template.loaders.app_directories.Loader', + ) +else: + TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, + ]