]> git.ozlabs.org Git - patchwork/blob - apps/settings.py
settings: Resolve all but one Django 1.7 warning
[patchwork] / apps / settings.py
1 # Django settings for patchwork project.
2 import os
3 import django
4
5 DEBUG = True
6 TEMPLATE_DEBUG = DEBUG
7
8 ADMINS = (
9      ('Jeremy Kerr', 'jk@ozlabs.org'),
10 )
11
12 MANAGERS = ADMINS
13
14 DATABASES = {
15     'default': {
16         'ENGINE': 'django.db.backends.postgresql_psycopg2',
17         'NAME': 'patchwork',
18     },
19 }
20
21 # Local time zone for this installation. Choices can be found here:
22 # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
23 # although not all variations may be possible on all operating systems.
24 # If running in a Windows environment this must be set to the same as your
25 # system time zone.
26 TIME_ZONE = 'Australia/Canberra'
27
28 # Language code for this installation. All choices can be found here:
29 # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
30 # http://blogs.law.harvard.edu/tech/stories/storyReader$15
31 LANGUAGE_CODE = 'en-au'
32
33 SITE_ID = 1
34
35 # If you set this to False, Django will make some optimizations so as not
36 # to load the internationalization machinery.
37 USE_I18N = True
38
39 # URL that handles the media served from MEDIA_ROOT.
40 # Example: "http://media.lawrence.com"
41 MEDIA_URL = ''
42
43 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
44 # trailing slash.
45 # Examples: "http://foo.com/media/", "/media/".
46 ADMIN_MEDIA_PREFIX = '/media/'
47
48 # Make this unique, and don't share it with anybody.
49 SECRET_KEY = '00000000000000000000000000000000000000000000000000'
50
51 # List of callables that know how to import templates from various sources.
52 TEMPLATE_LOADERS = (
53     'django.template.loaders.filesystem.Loader',
54     'django.template.loaders.app_directories.Loader',
55 )
56
57 MIDDLEWARE_CLASSES = [
58     'django.middleware.common.CommonMiddleware',
59     'django.contrib.sessions.middleware.SessionMiddleware',
60     'django.contrib.auth.middleware.AuthenticationMiddleware',
61     'django.contrib.messages.middleware.MessageMiddleware',
62     'django.middleware.doc.XViewMiddleware',
63     'django.middleware.csrf.CsrfViewMiddleware',
64 ]
65
66 if django.VERSION < (1, 7):
67     MIDDLEWARE_CLASSES.append('django.middleware.doc.XViewMiddleware')
68 else:
69     MIDDLEWARE_CLASSES.append(
70         'django.contrib.admindocs.middleware.XViewMiddleware')
71     TEST_RUNNER = 'django.test.runner.DiscoverRunner'
72
73 ROOT_URLCONF = 'urls'
74
75 LOGIN_URL = '/user/login/'
76 LOGIN_REDIRECT_URL = '/user/'
77
78 ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
79 TEMPLATE_DIRS = (
80     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
81     # Always use forward slashes, even on Windows.
82     # Don't forget to use absolute paths, not relative paths.
83     os.path.join(ROOT_DIR, 'templates'),
84 )
85 # Absolute path to the directory that holds media.
86 # Example: "/home/media/media.lawrence.com/"
87 MEDIA_ROOT = os.path.join(
88     ROOT_DIR, 'lib', 'python', 'django', 'contrib', 'admin', 'media')
89
90 TEMPLATE_CONTEXT_PROCESSORS = (
91     "django.contrib.auth.context_processors.auth",
92     "django.core.context_processors.debug",
93     "django.core.context_processors.i18n",
94     "django.core.context_processors.media")
95
96 INSTALLED_APPS = (
97     'django.contrib.auth',
98     'django.contrib.contenttypes',
99     'django.contrib.sessions',
100     'django.contrib.sites',
101     'django.contrib.admin',
102     'patchwork',
103 )
104
105 DEFAULT_PATCHES_PER_PAGE = 100
106 DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
107
108 CONFIRMATION_VALIDITY_DAYS = 7
109
110 NOTIFICATION_DELAY_MINUTES = 10
111 NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
112
113 # Set to True to enable the Patchwork XML-RPC interface
114 ENABLE_XMLRPC = False
115
116 # set to True to enable redirections or URLs from previous versions
117 # of patchwork
118 COMPAT_REDIR = True
119
120 # Set to True to always generate https:// links instead of guessing
121 # the scheme based on current access. This is useful if SSL protocol
122 # is terminated upstream of the server (e.g. at the load balancer)
123 FORCE_HTTPS_LINKS = False
124
125 try:
126     from local_settings import *
127 except ImportError, ex:
128     import sys
129     sys.stderr.write(\
130             ("settings.py: error importing local settings file:\n" + \
131             "\t%s\n" + \
132             "Do you have a local_settings.py module?\n") % str(ex))
133     raise