From 131bc18d0ebedb97a8d919cac8026e7a3cd8bb03 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 25 Feb 2010 18:17:29 +0000 Subject: [PATCH] Fixed URLconf issues, added seperate live/test db setting --- settings.py | 25 ++++++++++++++++++------- sso/urls.py | 4 +++- sso/views.py | 2 +- urls.py | 1 + 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/settings.py b/settings.py index f353f6e..f3859e9 100644 --- a/settings.py +++ b/settings.py @@ -1,4 +1,7 @@ +import os + # Django settings for login project. +LIVE = False DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -9,12 +12,20 @@ ADMINS = ( MANAGERS = ADMINS -DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = 'dreddit_sso' # Or path to database file if using sqlite3. -DATABASE_USER = 'dreddit_sso' # Not used with sqlite3. -DATABASE_PASSWORD = 'bf6431670c657b9b62f08353d61047c4552ed3d4' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. +if LIVE: + DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + DATABASE_NAME = 'dreddit_sso' # Or path to database file if using sqlite3. + DATABASE_USER = 'dreddit_sso' # Not used with sqlite3. + DATABASE_PASSWORD = 'bf6431670c657b9b62f08353d61047c4552ed3d4' # Not used with sqlite3. + DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. + DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. +else: + DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + DATABASE_NAME = 'dreddit_sso.db' # Or path to database file if using sqlite3. + DATABASE_USER = '' # Not used with sqlite3. + DATABASE_PASSWORD = '' # Not used with sqlite3. + DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. + DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name @@ -63,7 +74,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.auth.middleware.AuthenticationMiddleware', ) -ROOT_URLCONF = 'login.urls' +ROOT_URLCONF = 'urls' TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), "templates"), diff --git a/sso/urls.py b/sso/urls.py index 024d13e..a718d78 100644 --- a/sso/urls.py +++ b/sso/urls.py @@ -1,5 +1,7 @@ from django.conf.urls.defaults import * +from sso import views + urlpatterns = patterns('', - (r'^profile/' 'views.profile'), + (r'^profile/', views.profile), ) diff --git a/sso/views.py b/sso/views.py index 8a71fe4..4d669e2 100644 --- a/sso/views.py +++ b/sso/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render_to_response from django.contrib.auth.decorators import login_required -from sso.models import ServiceAccounts +from sso.models import ServiceAccount def index(request): pass diff --git a/urls.py b/urls.py index 3468f76..fcc3ded 100644 --- a/urls.py +++ b/urls.py @@ -6,5 +6,6 @@ admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), + (r'^accounts/', include('registration.backends.default.urls')), (r'^sso/', include('sso.urls')), )