From 4c44a504edbfe55b023cfc810ee73109a45738bd Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 16 Jun 2020 11:14:10 +0100 Subject: [PATCH] preparing for django 1.8 --- middleware.py | 5 ++++- profiles/utils.py | 5 +++-- settings.py | 12 ++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/middleware.py b/middleware.py index 51b6b76..0dbcd5c 100644 --- a/middleware.py +++ b/middleware.py @@ -45,4 +45,7 @@ def _resolves(url): resolve(url) return True except http.Http404: - return False \ No newline at end of file + return False + except: + print(url) + raise diff --git a/profiles/utils.py b/profiles/utils.py index c2dfd61..6e602e7 100644 --- a/profiles/utils.py +++ b/profiles/utils.py @@ -14,7 +14,8 @@ try: except ImportError: # django >= 1.7 SiteProfileNotAvailable = type('SiteProfileNotAvailable', (Exception,), {}) -from django.db.models import get_model +from django.db import models +#from django.db.models import get_model def get_profile_model(): @@ -28,7 +29,7 @@ def get_profile_model(): if (not hasattr(settings, 'AUTH_PROFILE_MODULE')) or \ (not settings.AUTH_PROFILE_MODULE): raise SiteProfileNotAvailable - profile_mod = get_model(*settings.AUTH_PROFILE_MODULE.split('.')) + profile_mod = models.get_model(*settings.AUTH_PROFILE_MODULE.split('.')) if profile_mod is None: raise SiteProfileNotAvailable return profile_mod diff --git a/settings.py b/settings.py index 513fc66..9cbb598 100644 --- a/settings.py +++ b/settings.py @@ -31,9 +31,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Django settings for troggle project. DEBUG = True -TEMPLATE_DEBUG = DEBUG -ALLOWED_HOSTS = ['expo.survex.com'] +ALLOWED_HOSTS = ['expo.survex.com','localhost', '127.0.0.1'] ADMINS = ( # ('Your Name', 'your_email@domain.com'), @@ -96,12 +95,14 @@ SMART_APPEND_SLASH = True # Make this unique, and don't share it with anybody. SECRET_KEY = 'a#vaeozn0)uz_9t_%v5n#tj)m+%ace6b_0(^fj!355qki*v)j2' +TEMPLATES = [{}] +TEMPLATE_DEBUG = DEBUG + # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) - authmodule = 'django.contrib.auth.context_processors.auth' TEMPLATE_CONTEXT_PROCESSORS = ( authmodule, "core.context.troggle_context", ) @@ -112,12 +113,8 @@ INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', -# 'django.contrib.sites', -# 'django.contrib.redirects', 'django.contrib.messages', 'django.contrib.staticfiles', -# 'django_extensions', -# 'tinymce', # 'registration', 'troggle.profiles', 'troggle.core', @@ -128,7 +125,6 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', -# 'django.contrib.redirects.middleware.RedirectFallbackMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',