From 06ba44aa10c4fe558b7130f88a1584bf4aee0961 Mon Sep 17 00:00:00 2001 From: Tanner Prestegard <tanner.prestegard@ligo.org> Date: Wed, 7 Dec 2016 11:26:37 -0600 Subject: [PATCH] modifying template settings and adding in debug info --- settings/default.py | 85 +++++++++++++++++++++++++++++---------------- templates/base.html | 14 +++++--- 2 files changed, 66 insertions(+), 33 deletions(-) diff --git a/settings/default.py b/settings/default.py index 2d6e665e2..2f4fa4a96 100644 --- a/settings/default.py +++ b/settings/default.py @@ -257,30 +257,64 @@ ADMIN_MEDIA_PREFIX = '/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = DEFAULT_SECRET_KEY +# Upgrade template settings to 1.8 +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + '/home/gracedb/gracedb/templates', + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + # Defaults + 'django.contrib.auth.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'django.core.context_processors.static', + # Extra additions + 'django.core.context_processors.request', + 'gracedb.middleware.auth.LigoAuthContext', + 'middleware.debug.LigoDebugContext', + 'ligoauth.context_processors.shib_login_url', + ], + }, + }, +] + # List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - #'django.template.loaders.filesystem.load_template_source', - # replaced by... - 'django.template.loaders.filesystem.Loader', - # Upgrade to 1.4 - #'django.template.loaders.app_directories.load_template_source', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.load_template_source', -) +#TEMPLATE_LOADERS = ( +# #'django.template.loaders.filesystem.load_template_source', +# # replaced by... +# 'django.template.loaders.filesystem.Loader', +# # Upgrade to 1.4 +# #'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.app_directories.Loader', +## 'django.template.loaders.eggs.load_template_source', +#) +# +#TEMPLATE_CONTEXT_PROCESSORS = ( +# #"django.core.context_processors.auth", +# # replaced by... +# "django.contrib.auth.context_processors.auth", +# "django.core.context_processors.debug", +# "django.core.context_processors.i18n", +# "django.core.context_processors.media", +# "django.core.context_processors.static", +# "django.core.context_processors.request", +# "gracedb.middleware.auth.LigoAuthContext", +# 'middleware.debug.LigoDebugContext', +# 'ligoauth.context_processors.shib_login_url', +#) +# +## 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 = ( +# "/home/gracedb/gracedb/templates", +#) -TEMPLATE_CONTEXT_PROCESSORS = ( - #"django.core.context_processors.auth", - # replaced by... - "django.contrib.auth.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "django.core.context_processors.media", - "django.core.context_processors.static", - "django.core.context_processors.request", - "gracedb.middleware.auth.LigoAuthContext", - 'middleware.debug.LigoDebugContext', - 'ligoauth.context_processors.shib_login_url', -) AUTHENTICATION_BACKENDS = ( # 'gracedb.middleware.auth.LigoAuthBackend', @@ -322,13 +356,6 @@ MIDDLEWARE_CLASSES = [ ROOT_URLCONF = 'urls' -TEMPLATE_DIRS = ( - # 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. - "/home/gracedb/gracedb/templates", -) - INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.admin', diff --git a/templates/base.html b/templates/base.html index 866070ceb..9d0e73dca 100644 --- a/templates/base.html +++ b/templates/base.html @@ -32,24 +32,30 @@ function changeTime(obj, label) { <div id="content"> <center> -<h1> GraceDB — Gravitational Wave Candidate Event Database</h1> +<h1>GraceDB — Gravitational Wave Candidate Event Database</h1> </center> {% block nav %} {% include "navbar_frag.html" %} {% endblock %} - <p> </p> <!-- bad way to create vertical space --> + <p> </p> <!-- bad way to create vertical space --> {% load flash %} {% flash %} <div id="status_block" class="{{ params.class }}">{{ msg }}</div> {% endflash %} +{% if user.is_staff %} +<!-- debug information for admins --> +<div id="debugDiv"> + <!--<pre>{% filter force_escape %} {% debug %} {% endfilter %}</pre> --> +</div> +{% endif %} - <h2>{% block heading %}Title{% endblock %}</h2> - + <h2>{% block heading %}Title{% endblock %}</h2> +<p>test</p> {% block content %}{% endblock %} </div> -- GitLab