development.py 1.62 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
from .base import *

INSTALLED_APPS += [
    'django_extensions',
    'debug_toolbar',
]

MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
] + MIDDLEWARE
MODERATION_ACTIVATED = True

DEBUG = True
ALLOWED_HOSTS = ['*']
SECRET_KEY = '0a1kbtt%as4624u*9+r+c%j1tlq&dc08==c3w604(4igc+t6tw'

# DATABASE
# After you have read the documentation, uncomment the
# block with the database system you would like to use.

# POSTGRESQL
# If bellow fails, your need to add DATABASE_URL and ENV to your virutalenv
try:
    CI_ENV = os.environ['ENV'] == 'CI'
except KeyError:
    CI_ENV = False


# Database config
if CI_ENV:
    # Should reflect gitlab-ci.yml
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'outgoing',
            'USER': 'outgoing',
            'PASSWORD': '',
            'HOST': 'postgres',
            'PORT': '5432',
        }
    }

else:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'outgoing',
            'USER': 'outgoing',
            'PASSWORD': 'outgoing',
            'HOST': '127.0.0.1',
            'PORT': '5432',
        }
    }

    # # Sqlite
    # PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
    # DATABASES = {
    #     'default': {
    #         'ENGINE': 'django.db.backends.sqlite3',
    #         'NAME': os.path.join(PROJECT_DIR, '../database.db'),
    #     }
    # }

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')