From b923247f195f5007fc7ef724d661f93d39ec1a05 Mon Sep 17 00:00:00 2001 From: Stephen Bronstein Date: Tue, 24 Apr 2012 17:02:42 -0700 Subject: [PATCH] changed settings.py to try strider db env variables, otherwise set for local --- klingsbo/settings.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/klingsbo/settings.py b/klingsbo/settings.py index 784cd86..6aa3fbb 100644 --- a/klingsbo/settings.py +++ b/klingsbo/settings.py @@ -30,18 +30,30 @@ #} - -# example dev config with postgres -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'klingsbo', # Or path to database file if using sqlite3. - 'USER': 'klingsbo', # Not used with sqlite3. - 'PASSWORD': 'klingsbo', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} +try: + #Strider db env variables + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'klingsbo', # Or path to database file if using sqlite3. + 'USER': os.environ['POSTGRESQL_USERNAME'], # Not used with sqlite3. + 'PASSWORD': os.environ['POSTGRESQL_PASSWORD'], # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': os.environ['POSTGRESQL_PORT'], # Set to empty string for default. Not used with sqlite3. + } + } +except: + # example dev config with postgres + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'klingsbo', # Or path to database file if using sqlite3. + 'USER': 'klingsbo', # Not used with sqlite3. + 'PASSWORD': 'klingsbo', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + '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