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
91
92
93
|
"""
Development settings for patchwork project.
These are also used in unit tests.
Design based on:
http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
"""
from __future__ import absolute_import
import django
from .base import * # noqa
#
# Core settings
# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
#
SECRET_KEY = '00000000000000000000000000000000000000000000000000'
DEBUG = True
if django.VERSION < (1, 8):
# In Django 1.8+, this is only necessary if the value differs from
# the value for 'DEBUG'
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': os.getenv('PW_TEST_DB_HOST', 'localhost'),
'PORT': os.getenv('PW_TEST_DB_PORT', ''),
'USER': os.getenv('PW_TEST_DB_USER', 'patchwork'),
'PASSWORD': os.getenv('PW_TEST_DB_PASS', 'password'),
'NAME': os.getenv('PW_TEST_DB_NAME', 'patchwork'),
},
}
if os.getenv('PW_TEST_DB_TYPE', None) == 'postgres':
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
if django.VERSION >= (1, 7):
DATABASES['default']['TEST'] = {
'CHARSET': 'utf8',
}
else:
DATABASES['default']['TEST_CHARSET'] = 'utf8'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
#
# Auth settings
# https://docs.djangoproject.com/en/1.8/ref/settings/#auth
#
# Use a faster, though less secure, password hasher for faster tests
# https://docs.djangoproject.com/es/1.9/topics/testing/overview/#password-hashing
PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
#
# Third-party application settings
#
# django-debug-toolbar
if django.VERSION >= (1, 8):
INSTALLED_APPS += [
'debug_toolbar'
]
DEBUG_TOOLBAR_PATCH_SETTINGS = False
# This should go first in the middleware classes
MIDDLEWARE_CLASSES = [
'debug_toolbar.middleware.DebugToolbarMiddleware',
] + MIDDLEWARE_CLASSES
INTERNAL_IPS = [
'127.0.0.1', '::1',
'172.17.0.1'
]
#
# Patchwork settings
#
ENABLE_XMLRPC = True
if django.VERSION >= (1, 7):
ENABLE_REST_API = True
|