Author: adrian Date: 2006-04-28 22:04:00 -0500 (Fri, 28 Apr 2006) New Revision: 2790
Modified: django/branches/magic-removal/docs/static_files.txt Log: magic-removal: Proofread docs/static_files.txt Modified: django/branches/magic-removal/docs/static_files.txt =================================================================== --- django/branches/magic-removal/docs/static_files.txt 2006-04-29 03:02:10 UTC (rev 2789) +++ django/branches/magic-removal/docs/static_files.txt 2006-04-29 03:04:00 UTC (rev 2790) @@ -31,7 +31,7 @@ Just put this in your URLconf_:: - (r'^site_media/(?P<path>.*)$', '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 @@ Example:: - (r'^site_media/(?P<path>.*)$', '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 @@ ``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 @@ (r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'news.views.article_detail'), ) - if DEBUG: + if settings.DEBUG: urlpatterns += patterns('', (r'^site_media/(?P<path>.*)$', '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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates -~----------~----~----~----~------~----~------~--~---