On 8/16/06, James Bennett <[EMAIL PROTECTED]> wrote:
> Being able to see the correct current URL is a vital security feature
> in web browsers, and (short of using JavaScript to open a new window
> which lacks a location bar -- something not guaranteed to work because
> browsers allow users to disable this ability) there is no way to
> accomplish this.

James, I agree that there are a lot of cases where this isn't a good
idea, but who's to say that the mp3 file, for example, is *not* the
correct resource for this URL? If the Django view only exists to
determine the resource which should be presented to the browser, then
an internal redirect would be exactly what you want.


Chris, If you could determine that you want to present a certain mp3
file, using only the URL, then you could use Apache's rewrite rules to
do exactly that, without forcing the browser to request a new page,
and without involving Django at all.

Unfortunately, once Apache has passed off a request to Django, you
will have to use Django views to return your result. If it's
absolutely necessary that a view return an mp3 file, then you could
write a view that opens the file on the filesystem and streams the
data out to the user. However, as mentioned in the documentation,
(this is how Django serves up media with the development server,) this
method is

 a) slow,
 b) prone to bugs, and
 c) not really what Django is best at

For serving up static files, you're probably better off leaving them
in a media directory, and letting Apache handle them, and just live
with the URL bar showing the real location.

Ian Clelland
<[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to