From 9e1f29b2795d3992d385dae9355bcdcc01901ca5 Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Fri, 1 Jun 2012 09:38:57 -0500 Subject: DBStats: Cleanup settings.py Remove hardcoded django.contrib.auth references. Replace django.contrib.auth.LOGIN_URL with LOGIN_URL Move django import check to the top of the file --- src/lib/Bcfg2/Server/Reports/settings.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/lib/Bcfg2/Server/Reports') diff --git a/src/lib/Bcfg2/Server/Reports/settings.py b/src/lib/Bcfg2/Server/Reports/settings.py index eb22f29f9..b27348aee 100644 --- a/src/lib/Bcfg2/Server/Reports/settings.py +++ b/src/lib/Bcfg2/Server/Reports/settings.py @@ -1,9 +1,12 @@ -import django import os import sys import getopt import Bcfg2.Options +try: + import django +except ImportError: + raise ImportError('Import of Django module failed. Is Django installed?') cfile_opt=Bcfg2.Options.CFILE cfiles=[cfile_opt.default, '/etc/bcfg2-web.conf'] @@ -131,11 +134,7 @@ AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', # The NIS group authorized to login to BCFG2's reportinvg system AUTHORIZED_GROUP = '' #create login url area: -try: - import django.contrib.auth -except ImportError: - raise ImportError('Import of Django module failed. Is Django installed?') -django.contrib.auth.LOGIN_URL = '/login' +LOGIN_URL = '/login' SESSION_EXPIRE_AT_BROWSER_CLOSE = True @@ -145,7 +144,6 @@ TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates". # Always use forward slashes, even on Windows. '/usr/share/python-support/python-django/django/contrib/admin/templates/', - 'Bcfg2.Server.Reports.reports' ) if django.VERSION[0] == 1 and django.VERSION[1] < 2: -- cgit v1.2.3-1-g7c22