On Feb 13, 5:52 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:

>
> Ah!  I was stumped before.  Not now.
>
> render_to_response expects a template and, I'm sure, opens the file as
> text.  You're giving it a binary.  Don't do that.  It'll be served as
> html mime type and line endings will get munged.
>
> If you -must- serve media with django, use the static media server
> that's built-in.  But you're really better off not doing that.

  ! Hey it works !

So my urls.py looks something like-------

from django.conf.urls.defaults import *
from django.conf import settings

urlpatterns = patterns('',
    )

if settings.DEBUG:
    urlpatterns += patterns('',
    # Anything from nav subdirectory is media
    (r'^polls/nav/(?P<path>.+)$', 'django.views.static.serve',
{'document_root': 'templates/polls/nav'}),
    )

urlpatterns += patterns('',
    #
    #Anything from polls not already caught is served by default view
    (r'^polls/(?P<name>.+)$', 'Mysite.polls.views.default'),
)

Will that handle media correctly when in production with DEBUG off?
Why am I better off not doing this?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to