forked from ambitioninc/ambition-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
90 lines (86 loc) · 3.03 KB
/
settings.py
File metadata and controls
90 lines (86 loc) · 3.03 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import os
import sys
from django.conf import settings
def configure_settings():
"""
Configures settings for manage.py and for run_tests.py.
"""
if not settings.configured:
# Determine the database settings depending on if a test_db var is set in CI mode or not
test_db = os.environ.get('DB', None)
if test_db is None:
db_config = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'ambition',
'USER': 'ambition',
'PASSWORD': 'ambition',
'HOST': 'db'
}
elif test_db == 'postgres':
db_config = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres',
'NAME': 'ambition_utils',
}
else:
raise RuntimeError('Unsupported test DB {0}'.format(test_db))
settings.configure(
TEST_RUNNER='django_nose.NoseTestSuiteRunner',
NOSE_ARGS=['--nocapture', '--nologcapture', '--verbosity=1'],
MIDDLEWARE_CLASSES=(),
DATABASES={
'default': db_config,
'mock-second-database': {
'ENGINE': 'django.db.backends.sqlite3',
'TEST_MIRROR': 'default',
},
},
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'ambition_utils',
'ambition_utils.tests',
'ambition_utils.activity',
'ambition_utils.anomaly',
'ambition_utils.postgres_lock',
'ambition_utils.rrule',
'ambition_utils.rrule.tests',
),
LOGGING={
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'standard': {
'format': '[%(asctime)s %(levelname)s] %(name)s:%(lineno)d \'%(message)s\'',
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'stream': sys.stdout,
'formatter': 'standard'
}
},
'loggers': {
'ambition_utils': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': True
},
}
},
ROOT_URLCONF='ambition_utils.urls',
TIME_ZONE='UTC',
USE_TZ=False,
TEMPLATES=[
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
}
]
)