Permalink
Browse files

Merge pull request #1 from sbronstein/master

switch database connection to DATABASE_URI env var
  • Loading branch information...
2 parents 6e22688 + 68ae894 commit c22fb6d7c7f2b73bdc8c804c4bf83c39f2987808 @sbronstein sbronstein committed Jun 2, 2012
Showing with 18 additions and 36 deletions.
  1. +2 −1 .gitignore
  2. BIN klingsbo/__init__.pyc
  3. +15 −35 klingsbo/settings.py
  4. BIN klingsbo/wsgi.pyc
  5. +1 −0 requirements.txt
View
@@ -1,3 +1,4 @@
*.db
*.pyc
-.DS_Store
+.DS_Store
+venv
View
Binary file not shown.
View
@@ -16,43 +16,23 @@
)
MANAGERS = ADMINS
+
+# the new Heroku way...now works with Strider.
+import dj_database_url
+DATABASES = {'default': dj_database_url.config(default='postgres://klingsbo:klingsbo@localhost/klingsbo')}
-try:
- #Strider db env variables
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'postgres', # 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': 'localhost', # 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.
- }
- }
- # example dev config w sqlite
- #DATABASES = {
- # 'default': {
- # 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- # 'NAME': 'klingsbo.db', # Or path to database file if using sqlite3.
- # 'USER': '', # Not used with sqlite3.
- # 'PASSWORD': '', # 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.
- # }
- #}
+# example dev config w sqlite
+#DATABASES = {
+# 'default': {
+# 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+# 'NAME': 'klingsbo.db', # Or path to database file if using sqlite3.
+# 'USER': '', # Not used with sqlite3.
+# 'PASSWORD': '', # 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:
View
Binary file not shown.
View
@@ -3,3 +3,4 @@ Django==1.4
South==0.7.4
gunicorn==0.14.2
wsgiref==0.1.2
+dj-database-url==0.2.0

0 comments on commit c22fb6d

Please sign in to comment.