Django

Code

Changeset 2790

Show
Ignore:
Timestamp:
04/28/06 22:04:00 (2 years ago)
Author:
adrian
Message:

magic-removal: Proofread docs/static_files.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/docs/static_files.txt

    r1457 r2790  
    3232Just put this in your URLconf_:: 
    3333 
    34     (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}), 
     34    (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}), 
    3535 
    3636...where ``site_media`` is the URL where your media will be rooted, and 
     
    6161Example:: 
    6262 
    63     (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media', 'show_indexes': True}), 
     63    (r'^site_media/(.*)$', 'django.views.static.serve', {'document_root': '/path/to/media', 'show_indexes': True}), 
    6464 
    6565You can customize the index view by creating a template called 
     
    101101 
    102102    from django.conf.urls.defaults import * 
    103     from django.conf.settings import DEBUG 
     103    from django.conf import settings 
    104104 
    105105    urlpatterns = patterns('', 
     
    110110    ) 
    111111 
    112     if DEBUG: 
     112    if settings.DEBUG: 
    113113        urlpatterns += patterns('', 
    114114            (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}), 
    115115        ) 
    116116 
    117 This code is straightforward. It imports the `DEBUG setting`_ and checks its 
    118 value. If it evaluates to ``True``, then ``site_media`` will be associated with 
    119 the ``django.views.static.serve`` view. If not (``DEBUG == False``), then the 
    120 view won't be made available. 
     117This code is straightforward. It imports the settings and checks the value of 
     118the ``DEBUG`` setting. If it evaluates to ``True``, then ``site_media`` will be 
     119associated with the ``django.views.static.serve`` view. If not 
     120(``DEBUG == False``), then the view won't be made available. 
    121121 
    122122Of course, the catch here is that you'll have to remember to set ``DEBUG=False``