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