Browse Source

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.

pull/7/head
Pēteris Caune 9 years ago
parent
commit
d2e483a8a0
1 changed files with 16 additions and 10 deletions
  1. +16
    -10
      hc/settings.py

+ 16
- 10
hc/settings.py View File

@ -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"])

Loading…
Cancel
Save