]> git.ozlabs.org Git - patchwork/blob - apps/settings.py
dbe0544af34595f708e61f532e5988d9377e0925
[patchwork] / apps / settings.py
1 # Django settings for patchwork project.
2
3 import os
4
5 import django
6
7 ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
8
9 #
10 # Core settings
11 # https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
12 #
13
14 # Models
15
16 INSTALLED_APPS = (
17     'django.contrib.auth',
18     'django.contrib.contenttypes',
19     'django.contrib.sessions',
20     'django.contrib.sites',
21     'django.contrib.admin',
22     'patchwork',
23 )
24
25 # HTTP
26
27 MIDDLEWARE_CLASSES = [
28     'django.middleware.common.CommonMiddleware',
29     'django.contrib.sessions.middleware.SessionMiddleware',
30     'django.contrib.auth.middleware.AuthenticationMiddleware',
31     'django.contrib.messages.middleware.MessageMiddleware',
32     'django.middleware.csrf.CsrfViewMiddleware',
33 ]
34
35 if django.VERSION < (1, 7):
36     MIDDLEWARE_CLASSES.append('django.middleware.doc.XViewMiddleware')
37 else:
38     MIDDLEWARE_CLASSES.append(
39         'django.contrib.admindocs.middleware.XViewMiddleware')
40     TEST_RUNNER = 'django.test.runner.DiscoverRunner'
41
42 # Debugging
43
44 DEBUG = True
45
46 if django.VERSION >= (1, 7):
47     TEST_RUNNER = 'django.test.runner.DiscoverRunner'
48
49 # Email
50
51 ADMINS = (
52      ('Jeremy Kerr', 'jk@ozlabs.org'),
53 )
54
55 MANAGERS = ADMINS
56
57 # Databases
58
59 DATABASES = {
60     'default': {
61         'ENGINE': 'django.db.backends.postgresql_psycopg2',
62         'NAME': 'patchwork',
63     },
64 }
65
66 # File Uploads
67
68 MEDIA_ROOT = os.path.join(
69     ROOT_DIR, 'lib', 'python', 'django', 'contrib', 'admin', 'media')
70
71 # Globalization
72
73 TIME_ZONE = 'Australia/Canberra'
74
75 LANGUAGE_CODE = 'en-au'
76
77 USE_I18N = True
78
79 # URLs
80
81 ROOT_URLCONF = 'urls'
82
83 # Security
84
85 # Make this unique, and don't share it with anybody.
86 SECRET_KEY = '00000000000000000000000000000000000000000000000000'
87
88 # Templates
89
90 TEMPLATE_DEBUG = True
91
92 TEMPLATE_DIRS = (
93     os.path.join(ROOT_DIR, 'templates'),
94 )
95
96
97 #
98 # Auth settings
99 # https://docs.djangoproject.com/en/1.6/ref/settings/#auth
100 #
101
102 ADMIN_MEDIA_PREFIX = '/media/'
103
104 LOGIN_URL = '/user/login/'
105 LOGIN_REDIRECT_URL = '/user/'
106
107
108 #
109 # Sites settings
110 # https://docs.djangoproject.com/en/1.6/ref/settings/#sites
111 #
112
113 SITE_ID = 1
114
115
116 #
117 # Patchwork settings
118 #
119
120 DEFAULT_PATCHES_PER_PAGE = 100
121 DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
122
123 CONFIRMATION_VALIDITY_DAYS = 7
124
125 NOTIFICATION_DELAY_MINUTES = 10
126 NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
127
128 # Set to True to enable the Patchwork XML-RPC interface
129 ENABLE_XMLRPC = False
130
131 # set to True to enable redirections or URLs from previous versions
132 # of patchwork
133 COMPAT_REDIR = True
134
135 # Set to True to always generate https:// links instead of guessing
136 # the scheme based on current access. This is useful if SSL protocol
137 # is terminated upstream of the server (e.g. at the load balancer)
138 FORCE_HTTPS_LINKS = False
139
140 try:
141     from local_settings import *
142 except ImportError, ex:
143     import sys
144     sys.stderr.write(\
145             ("settings.py: error importing local settings file:\n" + \
146             "\t%s\n" + \
147             "Do you have a local_settings.py module?\n") % str(ex))
148     raise