Merge pull request #270 from ThomasWaldmann/fix-templating
Fix templating
This commit is contained in:
commit
634996be57
@ -91,7 +91,7 @@ class CustomTemplateView(TemplateView):
|
|||||||
def dispatch(self, *args, **kwargs):
|
def dispatch(self, *args, **kwargs):
|
||||||
self.template_name = 'main/custom/%s' % kwargs.get('template')
|
self.template_name = 'main/custom/%s' % kwargs.get('template')
|
||||||
try:
|
try:
|
||||||
template.loader.select_template(self.template_name)
|
template.loader.select_template([self.template_name, ])
|
||||||
return super(CustomTemplateView, self).dispatch(*args, **kwargs)
|
return super(CustomTemplateView, self).dispatch(*args, **kwargs)
|
||||||
except template.TemplateDoesNotExist:
|
except template.TemplateDoesNotExist:
|
||||||
raise Http404
|
raise Http404
|
||||||
|
@ -8,7 +8,6 @@ Note: do not directly use these settings, rather use "dev" or "prod".
|
|||||||
# project's settings on top of that. Due to this, no import * is required here.
|
# project's settings on top of that. Due to this, no import * is required here.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import django.conf.global_settings as DEFAULT_SETTINGS
|
|
||||||
|
|
||||||
# To make this work, put a unique, long, random, secret string into your environment.
|
# To make this work, put a unique, long, random, secret string into your environment.
|
||||||
# E.g. in ~/.bashrc: export SECRET_KEY="..."
|
# E.g. in ~/.bashrc: export SECRET_KEY="..."
|
||||||
@ -109,12 +108,36 @@ STATICFILES_FINDERS = (
|
|||||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||||
)
|
)
|
||||||
|
|
||||||
# List of callables that know how to import templates from various sources.
|
TEMPLATES = [
|
||||||
TEMPLATE_LOADERS = (
|
{
|
||||||
'django.template.loaders.filesystem.Loader',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'django.template.loaders.app_directories.Loader',
|
'DIRS': [
|
||||||
# 'django.template.loaders.eggs.Loader',
|
# '/where/you/have/additional/templates',
|
||||||
)
|
],
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
|
||||||
|
# list if you haven't customized them:
|
||||||
|
#'django.contrib.auth.context_processors.auth',
|
||||||
|
#'django.template.context_processors.debug',
|
||||||
|
'django.template.context_processors.i18n',
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'nsupdate.context_processors.add_settings',
|
||||||
|
'nsupdate.context_processors.update_ips',
|
||||||
|
#'django.template.context_processors.media',
|
||||||
|
#'django.template.context_processors.static',
|
||||||
|
#'django.template.context_processors.tz',
|
||||||
|
#'django.contrib.messages.context_processors.messages',
|
||||||
|
'social.apps.django_app.context_processors.backends',
|
||||||
|
'social.apps.django_app.context_processors.login_redirect',
|
||||||
|
],
|
||||||
|
'loaders': [
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
@ -127,29 +150,11 @@ MIDDLEWARE_CLASSES = (
|
|||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
)
|
)
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
|
|
||||||
'django.core.context_processors.i18n',
|
|
||||||
'django.core.context_processors.request',
|
|
||||||
'nsupdate.context_processors.add_settings',
|
|
||||||
'nsupdate.context_processors.update_ips',
|
|
||||||
'social.apps.django_app.context_processors.backends',
|
|
||||||
'social.apps.django_app.context_processors.login_redirect',
|
|
||||||
)
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'nsupdate.urls'
|
ROOT_URLCONF = 'nsupdate.urls'
|
||||||
|
|
||||||
# Python dotted path to the WSGI application used by Django's runserver.
|
# Python dotted path to the WSGI application used by Django's runserver.
|
||||||
WSGI_APPLICATION = 'nsupdate.wsgi.application'
|
WSGI_APPLICATION = 'nsupdate.wsgi.application'
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
|
||||||
# you can add site-specific template dirs here to customize nsupdate.info
|
|
||||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
|
||||||
# Always use forward slashes, even on Windows.
|
|
||||||
# Don't forget to use absolute paths, not relative paths.
|
|
||||||
# TEMPLATE_DIRS must be a tuple, so don't forget the trailing comma if you
|
|
||||||
# put a single entry in here!
|
|
||||||
)
|
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
@ -5,7 +5,6 @@ settings for development / unit tests
|
|||||||
from .base import *
|
from .base import *
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
SECRET_KEY = 'UNSECURE_BECAUSE_WE_ARE_DEVELOPING'
|
SECRET_KEY = 'UNSECURE_BECAUSE_WE_ARE_DEVELOPING'
|
||||||
WE_HAVE_TLS = False # True if you run a https site also, suggest that site to users if they work on the http site.
|
WE_HAVE_TLS = False # True if you run a https site also, suggest that site to users if they work on the http site.
|
||||||
|
@ -5,7 +5,6 @@ settings for production
|
|||||||
from .base import *
|
from .base import *
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
|
||||||
|
|
||||||
WE_HAVE_TLS = True # True if you run a https site also, suggest that site to users if they work on the http site.
|
WE_HAVE_TLS = True # True if you run a https site also, suggest that site to users if they work on the http site.
|
||||||
CSRF_COOKIE_SECURE = WE_HAVE_TLS
|
CSRF_COOKIE_SECURE = WE_HAVE_TLS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user