Django

Code

root/django/trunk/django/conf/global_settings.py

Revision 7814, 13.8 kB (checked in by jacob, 3 days ago)

Fixed #2070: refactored Django's file upload capabilities.

A description of the new features can be found in the new upload handling documentation; the executive summary is that Django will now happily handle uploads of large files without issues.

This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details.

  • Property svn:eol-style set to native
  • Property svn:keywords set to LastChangedRevision
Line 
1 # Default Django settings. Override these with settings in the module
2 # pointed-to by the DJANGO_SETTINGS_MODULE environment variable.
3
4 # This is defined here as a do-nothing function because we can't import
5 # django.utils.translation -- that module depends on the settings.
6 gettext_noop = lambda s: s
7
8 ####################
9 # CORE             #
10 ####################
11
12 DEBUG = False
13 TEMPLATE_DEBUG = False
14
15 # Whether the framework should propagate raw exceptions rather than catching
16 # them. This is useful under some testing siutations and should never be used
17 # on a live site.
18 DEBUG_PROPAGATE_EXCEPTIONS = False
19
20 # Whether to use the "Etag" header. This saves bandwidth but slows down performance.
21 USE_ETAGS = False
22
23 # People who get code error notifications.
24 # In the format (('Full Name', 'email@domain.com'), ('Full Name', 'anotheremail@domain.com'))
25 ADMINS = ()
26
27 # Tuple of IP addresses, as strings, that:
28 #   * See debug comments, when DEBUG is true
29 #   * Receive x-headers
30 INTERNAL_IPS = ()
31
32 # Local time zone for this installation. All choices can be found here:
33 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all
34 # systems may support all possibilities).
35 TIME_ZONE = 'America/Chicago'
36
37 # Language code for this installation. All choices can be found here:
38 # http://www.i18nguy.com/unicode/language-identifiers.html
39 LANGUAGE_CODE = 'en-us'
40
41 # Languages we provide translations for, out of the box. The language name
42 # should be the utf-8 encoded local name for the language.
43 LANGUAGES = (
44     ('ar', gettext_noop('Arabic')),
45     ('bn', gettext_noop('Bengali')),
46     ('bg', gettext_noop('Bulgarian')),
47     ('ca', gettext_noop('Catalan')),
48     ('cs', gettext_noop('Czech')),
49     ('cy', gettext_noop('Welsh')),
50     ('da', gettext_noop('Danish')),
51     ('de', gettext_noop('German')),
52     ('el', gettext_noop('Greek')),
53     ('en', gettext_noop('English')),
54     ('es', gettext_noop('Spanish')),
55     ('et', gettext_noop('Estonian')),
56     ('es-ar', gettext_noop('Argentinean Spanish')),
57     ('eu', gettext_noop('Basque')),
58     ('fa', gettext_noop('Persian')),
59     ('fi', gettext_noop('Finnish')),
60     ('fr', gettext_noop('French')),
61     ('ga', gettext_noop('Irish')),
62     ('gl', gettext_noop('Galician')),
63     ('hu', gettext_noop('Hungarian')),
64     ('he', gettext_noop('Hebrew')),
65     ('hr', gettext_noop('Croatian')),
66     ('is', gettext_noop('Icelandic')),
67     ('it', gettext_noop('Italian')),
68     ('ja', gettext_noop('Japanese')),
69     ('ka', gettext_noop('Georgian')),
70     ('ko', gettext_noop('Korean')),
71     ('km', gettext_noop('Khmer')),
72     ('kn', gettext_noop('Kannada')),
73     ('lv', gettext_noop('Latvian')),
74     ('lt', gettext_noop('Lithuanian')),
75     ('mk', gettext_noop('Macedonian')),
76     ('nl', gettext_noop('Dutch')),
77     ('no', gettext_noop('Norwegian')),
78     ('pl', gettext_noop('Polish')),
79     ('pt', gettext_noop('Portugese')),
80     ('pt-br', gettext_noop('Brazilian Portuguese')),
81     ('ro', gettext_noop('Romanian')),
82     ('ru', gettext_noop('Russian')),
83     ('sk', gettext_noop('Slovak')),
84     ('sl', gettext_noop('Slovenian')),
85     ('sr', gettext_noop('Serbian')),
86     ('sv', gettext_noop('Swedish')),
87     ('ta', gettext_noop('Tamil')),
88     ('te', gettext_noop('Telugu')),
89     ('tr', gettext_noop('Turkish')),
90     ('uk', gettext_noop('Ukrainian')),
91     ('zh-cn', gettext_noop('Simplified Chinese')),
92     ('zh-tw', gettext_noop('Traditional Chinese')),
93 )
94
95 # Languages using BiDi (right-to-left) layout
96 LANGUAGES_BIDI = ("he", "ar", "fa")
97
98 # If you set this to False, Django will make some optimizations so as not
99 # to load the internationalization machinery.
100 USE_I18N = True
101 LOCALE_PATHS = ()
102 LANGUAGE_COOKIE_NAME = 'django_language'
103
104 # Not-necessarily-technical managers of the site. They get broken link
105 # notifications and other various e-mails.
106 MANAGERS = ADMINS
107
108 # Default content type and charset to use for all HttpResponse objects, if a
109 # MIME type isn't manually specified. These are used to construct the
110 # Content-Type header.
111 DEFAULT_CONTENT_TYPE = 'text/html'
112 DEFAULT_CHARSET = 'utf-8'
113
114 # Encoding of files read from disk (template and initial SQL files).
115 FILE_CHARSET = 'utf-8'
116
117 # E-mail address that error messages come from.
118 SERVER_EMAIL = 'root@localhost'
119
120 # Whether to send broken-link e-mails.
121 SEND_BROKEN_LINK_EMAILS = False
122
123 # Database connection info.
124 DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
125 DATABASE_NAME = ''             # Or path to database file if using sqlite3.
126 DATABASE_USER = ''             # Not used with sqlite3.
127 DATABASE_PASSWORD = ''         # Not used with sqlite3.
128 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
129 DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
130 DATABASE_OPTIONS = {}          # Set to empty dictionary for default.
131
132 # Host for sending e-mail.
133 EMAIL_HOST = 'localhost'
134
135 # Port for sending e-mail.
136 EMAIL_PORT = 25
137
138 # Optional SMTP authentication information for EMAIL_HOST.
139 EMAIL_HOST_USER = ''
140 EMAIL_HOST_PASSWORD = ''
141 EMAIL_USE_TLS = False
142
143 # List of strings representing installed apps.
144 INSTALLED_APPS = ()
145
146 # List of locations of the template source files, in search order.
147 TEMPLATE_DIRS = ()
148
149 # List of callables that know how to import templates from various sources.
150 # See the comments in django/core/template/loader.py for interface
151 # documentation.
152 TEMPLATE_LOADERS = (
153     'django.template.loaders.filesystem.load_template_source',
154     'django.template.loaders.app_directories.load_template_source',
155 #     'django.template.loaders.eggs.load_template_source',
156 )
157
158 # List of processors used by RequestContext to populate the context.
159 # Each one should be a callable that takes the request object as its
160 # only parameter and returns a dictionary to add to the context.
161 TEMPLATE_CONTEXT_PROCESSORS = (
162     'django.core.context_processors.auth',
163     'django.core.context_processors.debug',
164     'django.core.context_processors.i18n',
165     'django.core.context_processors.media',
166 #    'django.core.context_processors.request',
167 )
168
169 # Output to use in template system for invalid (e.g. misspelled) variables.
170 TEMPLATE_STRING_IF_INVALID = ''
171
172 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
173 # trailing slash.
174 # Examples: "http://foo.com/media/", "/media/".
175 ADMIN_MEDIA_PREFIX = '/media/'
176
177 # Default e-mail address to use for various automated correspondence from
178 # the site managers.
179 DEFAULT_FROM_EMAIL = 'webmaster@localhost'
180
181 # Subject-line prefix for email messages send with django.core.mail.mail_admins
182 # or ...mail_managers.  Make sure to include the trailing space.
183 EMAIL_SUBJECT_PREFIX = '[Django] '
184
185 # Whether to append trailing slashes to URLs.
186 APPEND_SLASH = True
187
188 # Whether to prepend the "www." subdomain to URLs that don't have it.
189 PREPEND_WWW = False
190
191 # List of compiled regular expression objects representing User-Agent strings
192 # that are not allowed to visit any page, systemwide. Use this for bad
193 # robots/crawlers. Here are a few examples:
194 #     import re
195 #     DISALLOWED_USER_AGENTS = (
196 #         re.compile(r'^NaverBot.*'),
197 #         re.compile(r'^EmailSiphon.*'),
198 #         re.compile(r'^SiteSucker.*'),
199 #         re.compile(r'^sohu-search')
200 #     )
201 DISALLOWED_USER_AGENTS = ()
202
203 ABSOLUTE_URL_OVERRIDES = {}
204
205 # Tuple of strings representing allowed prefixes for the {% ssi %} tag.
206 # Example: ('/home/html', '/var/www')
207 ALLOWED_INCLUDE_ROOTS = ()
208
209 # If this is a admin settings module, this should be a list of
210 # settings modules (in the format 'foo.bar.baz') for which this admin
211 # is an admin.
212 ADMIN_FOR = ()
213
214 # 404s that may be ignored.
215 IGNORABLE_404_STARTS = ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
216 IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')
217
218 # A secret key for this particular Django installation. Used in secret-key
219 # hashing algorithms. Set this in your settings, or Django will complain
220 # loudly.
221 SECRET_KEY = ''
222
223 # Path to the "jing" executable -- needed to validate XMLFields
224 JING_PATH = "/usr/bin/jing"
225
226 # Absolute path to the directory that holds media.
227 # Example: "/home/media/media.lawrence.com/"
228 MEDIA_ROOT = ''
229
230 # URL that handles the media served from MEDIA_ROOT.
231 # Example: "http://media.lawrence.com"
232 MEDIA_URL = ''
233
234 # List of upload handler classes to be applied in order.
235 FILE_UPLOAD_HANDLERS = (
236     'django.core.files.uploadhandler.MemoryFileUploadHandler',
237     'django.core.files.uploadhandler.TemporaryFileUploadHandler',
238 )
239
240 # Maximum size, in bytes, of a request before it will be streamed to the
241 # file system instead of into memory.
242 FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB
243
244 # Directory in which upload streamed files will be temporarily saved. A value of
245 # `None` will make Django use the operating system's default temporary directory
246 # (i.e. "/tmp" on *nix systems).
247 FILE_UPLOAD_TEMP_DIR = None
248
249 # Default formatting for date objects. See all available format strings here:
250 # http://www.djangoproject.com/documentation/templates/#now
251 DATE_FORMAT = 'N j, Y'
252
253 # Default formatting for datetime objects. See all available format strings here:
254 # http://www.djangoproject.com/documentation/templates/#now
255 DATETIME_FORMAT = 'N j, Y, P'
256
257 # Default formatting for time objects. See all available format strings here:
258 # http://www.djangoproject.com/documentation/templates/#now
259 TIME_FORMAT = 'P'
260
261 # Default formatting for date objects when only the year and month are relevant.
262 # See all available format strings here:
263 # http://www.djangoproject.com/documentation/templates/#now
264 YEAR_MONTH_FORMAT = 'F Y'
265
266 # Default formatting for date objects when only the month and day are relevant.
267 # See all available format strings here:
268 # http://www.djangoproject.com/documentation/templates/#now
269 MONTH_DAY_FORMAT = 'F j'
270
271 # Do you want to manage transactions manually?
272 # Hint: you really don't!
273 TRANSACTIONS_MANAGED = False
274
275 # The User-Agent string to use when checking for URL validity through the
276 # isExistingURL validator.
277 from django import get_version
278 URL_VALIDATOR_USER_AGENT = "Django/%s (http://www.djangoproject.com)" % get_version()
279
280 # The tablespaces to use for each model when not specified otherwise.
281 DEFAULT_TABLESPACE = ''
282 DEFAULT_INDEX_TABLESPACE = ''
283
284 ##############
285 # MIDDLEWARE #
286 ##############
287
288 # List of middleware classes to use.  Order is important; in the request phase,
289 # this middleware classes will be applied in the order given, and in the
290 # response phase the middleware will be applied in reverse order.
291 MIDDLEWARE_CLASSES = (
292     'django.contrib.sessions.middleware.SessionMiddleware',
293     'django.contrib.auth.middleware.AuthenticationMiddleware',
294 #     'django.middleware.http.ConditionalGetMiddleware',
295 #     'django.middleware.gzip.GZipMiddleware',
296     'django.middleware.common.CommonMiddleware',
297     'django.middleware.doc.XViewMiddleware',
298 )
299
300 ############
301 # SESSIONS #
302 ############
303
304 SESSION_COOKIE_NAME = 'sessionid'                       # Cookie name. This can be whatever you want.
305 SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2               # Age of cookie, in seconds (default: 2 weeks).
306 SESSION_COOKIE_DOMAIN = None                            # A string like ".lawrence.com", or None for standard domain cookie.
307 SESSION_COOKIE_SECURE = False                           # Whether the session cookie should be secure (https:// only).
308 SESSION_COOKIE_PATH = '/'                               # The path of the session cookie.
309 SESSION_SAVE_EVERY_REQUEST = False                      # Whether to save the session data on every request.
310 SESSION_EXPIRE_AT_BROWSER_CLOSE = False                 # Whether a user's session cookie expires when the Web browser is closed.
311 SESSION_ENGINE = 'django.contrib.sessions.backends.db'  # The module to store session data
312 SESSION_FILE_PATH = None                                # Directory to store session files if using the file session module. If None, the backend will use a sensible default.
313
314 #########
315 # CACHE #
316 #########
317
318 # The cache backend to use.  See the docstring in django.core.cache for the
319 # possible values.
320 CACHE_BACKEND = 'locmem://'
321 CACHE_MIDDLEWARE_KEY_PREFIX = ''
322 CACHE_MIDDLEWARE_SECONDS = 600
323
324 ####################
325 # COMMENTS         #
326 ####################
327
328 COMMENTS_ALLOW_PROFANITIES = False
329
330 # The profanities that will trigger a validation error in the
331 # 'hasNoProfanities' validator. All of these should be in lowercase.
332 PROFANITIES_LIST = ('asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit')
333
334 # The group ID that designates which users are banned.
335 # Set to None if you're not using it.
336 COMMENTS_BANNED_USERS_GROUP = None
337
338 # The group ID that designates which users can moderate comments.
339 # Set to None if you're not using it.
340 COMMENTS_MODERATORS_GROUP = None
341
342 # The group ID that designates the users whose comments should be e-mailed to MANAGERS.
343 # Set to None if you're not using it.
344 COMMENTS_SKETCHY_USERS_GROUP = None
345
346 # The system will e-mail MANAGERS the first COMMENTS_FIRST_FEW comments by each
347 # user. Set this to 0 if you want to disable it.
348 COMMENTS_FIRST_FEW = 0
349
350 # A tuple of IP addresses that have been banned from participating in various
351 # Django-powered features.
352 BANNED_IPS = ()
353
354 ##################
355 # AUTHENTICATION #
356 ##################
357
358 AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
359
360 LOGIN_URL = '/accounts/login/'
361
362 LOGOUT_URL = '/accounts/logout/'
363
364 LOGIN_REDIRECT_URL = '/accounts/profile/'
365
366 ###########
367 # TESTING #
368 ###########
369
370 # The name of the method to use to invoke the test suite
371 TEST_RUNNER = 'django.test.simple.run_tests'
372
373 # The name of the database to use for testing purposes.
374 # If None, a name of 'test_' + DATABASE_NAME will be assumed
375 TEST_DATABASE_NAME = None
376
377 # Strings used to set the character set and collation order for the test
378 # database. These values are passed literally to the server, so they are
379 # backend-dependent. If None, no special settings are sent (system defaults are
380 # used).
381 TEST_DATABASE_CHARSET = None
382 TEST_DATABASE_COLLATION = None
383
384 ############
385 # FIXTURES #
386 ############
387
388 # The list of directories to search for fixtures
389 FIXTURE_DIRS = ()
Note: See TracBrowser for help on using the browser.