Changes between Initial Version and Version 1 of Ticket #15199, comment 4


Ignore:
Timestamp:
Feb 1, 2011, 1:32:55 PM (14 years ago)
Author:
Jannis Leidel

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15199, comment 4

    initial v1  
    11Replying to [comment:2 brutasse]:
    2 > Hmmm this is trickier. With the patch applied, the media files aren't served by staticfiles but defining a custom view won't work either.
    3 >
    4 > {{{
    5 > urlpatterns += patterns('django.contrib.staticfiles.views',
    6 >     url(r'^static/media/(?P<path>.*)$', 'serve',
    7 >         {'document_root': settings.MEDIA_ROOT}),
    8 > )
    9 > }}}
    102>
    113> The 'serve' view is called, but the options dict is not passed to the view. 'document_root' is swallowed somewhere and ends up as None in the view, something bad probably happens in the staticfiles handler. If I change MEDIA_URL to '/static_media/' and the URL pattern to {{{r'^static_media/(?P<path>.*)$'}}}, the options dict is correctly passed to the view.
    124
    135Not sure what you mean with "something bad happens", the view looks just fine: source:django/trunk/django/contrib/staticfiles/views.py#L23
    14 
    15 > I thought modifying _should_handle() on !StaticFilesHandler would do the job, but apparently it's not enough. The staticfiles handler isn't transparently giving the control back to the parent WSGIHandler if _should_handle returns false.
Back to Top