From 7543588860906b754afb9d064f0f3e72a9ee337b Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 29 Apr 2006 03:04:00 +0000 Subject: [PATCH] magic-removal: Proofread docs/static_files.txt git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2790 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/static_files.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/static_files.txt b/docs/static_files.txt index 333bb12e22..d8d90e52d5 100644 --- a/docs/static_files.txt +++ b/docs/static_files.txt @@ -31,7 +31,7 @@ How to do it Just put this in your URLconf_:: - (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}), + (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}), ...where ``site_media`` is the URL where your media will be rooted, and ``/path/to/media`` is the filesystem root for your media. @@ -60,7 +60,7 @@ listings for directories. Example:: - (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': '/path/to/media', 'show_indexes': True}), + (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': '/path/to/media', 'show_indexes': True}), You can customize the index view by creating a template called ``static/directory_index``. That template gets two objects in its context: @@ -100,7 +100,7 @@ Do this by wrapping an ``if DEBUG`` statement around the ``django.views.static.serve`` inclusion. Here's a full example URLconf:: from django.conf.urls.defaults import * - from django.conf.settings import DEBUG + from django.conf import settings urlpatterns = patterns('', (r'^/articles/2003/$', 'news.views.special_case_2003'), @@ -109,15 +109,15 @@ Do this by wrapping an ``if DEBUG`` statement around the (r'^/articles/(?P\d{4})/(?P\d{2})/(?P\d+)/$', 'news.views.article_detail'), ) - if DEBUG: + if settings.DEBUG: urlpatterns += patterns('', (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}), ) -This code is straightforward. It imports the `DEBUG setting`_ and checks its -value. If it evaluates to ``True``, then ``site_media`` will be associated with -the ``django.views.static.serve`` view. If not (``DEBUG == False``), then the -view won't be made available. +This code is straightforward. It imports the settings and checks the value of +the ``DEBUG`` setting. If it evaluates to ``True``, then ``site_media`` will be +associated with the ``django.views.static.serve`` view. If not +(``DEBUG == False``), then the view won't be made available. Of course, the catch here is that you'll have to remember to set ``DEBUG=False`` in your production settings file. But you should be doing that anyway.