> Hi! If I have some html file somewhere (i.e. /var/file), how to
> redirect user to it? It is not a template and not in a template
> folder. Thanks :)

"Redirect" probably isn't the word you wanted there.  If you really
meant "How do I make my view function display the contents of an
arbitrary HTML file?", the answer is:

def showvarfile(request):
  return HttpResponse(open('/var/file').read())

As you can see, it's your own Python code reading the file's contents
and sending it back to the browser.  So this works even if '/var/file'
isn't in a directory that your webserver is serving.  That comes with
some caveats, of course -- it's usually not the best way to do things,
and is not as efficient as just letting the webserver serve it -- but
I think that's what you were asking for...

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to