From d2e483a8a00ea5c57be61e25e9e07a13659ee3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Thu, 13 Aug 2015 22:25:44 +0300 Subject: [PATCH] Default database engine is now SQLite. So when setting up dev environment, one does not initially need to worry about databases. For production though please use postgres. --- hc/settings.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/hc/settings.py b/hc/settings.py index d22a5a67..188ab161 100644 --- a/hc/settings.py +++ b/hc/settings.py @@ -69,30 +69,34 @@ TEMPLATES = [ WSGI_APPLICATION = 'hc.wsgi.application' +# Default database engine is SQLite. So one can just check out code, +# install requirements.txt and do manage.py runserver and it works DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'hc', - 'USER': 'postgres', - 'TEST': {'CHARSET': 'UTF8'} + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': './hc.sqlite', } } -if os.environ.get("DB") == "mysql": +# You can switch database engine to postgres or mysql using environment +# variable 'DB'. Travis CI does this. +if os.environ.get("DB") == "postgres": DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'USER': 'root', + 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'hc', + 'USER': 'postgres', 'TEST': {'CHARSET': 'UTF8'} } } -if os.environ.get("DB") == "sqlite": +if os.environ.get("DB") == "mysql": DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': './hc.sqlite', + 'ENGINE': 'django.db.backends.mysql', + 'USER': 'root', + 'NAME': 'hc', + 'TEST': {'CHARSET': 'UTF8'} } } @@ -126,3 +130,5 @@ try: from local_settings import * except ImportError as e: warnings.warn("local_settings.py not found, using defaults") + +print ("db engine: %s" % DATABASES["default"]["ENGINE"]) \ No newline at end of file