On Sep 30, 12:20 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-09-29 at 18:57 -0700, felix wrote:
> > I'm trying to fix some urls in my templates
>
> > these are urls linking to the admins site that cannot use the {% url
> > %} tag or reverse.
>
> > these urls are "absolute" in that they don't use reverse (which is
> > preferable, god bless django)
> > but the admin urls are not addressable by name, so I link to them
> > "absolute"ly
>
> > but but if you have installed your django not on the root of your
> > website:
>
> > <Location "/sustain">
> > ...
> >     PythonOption django.root /sustain
> > ...
> > </Location>
>
> > questions:
>
> > then how can I access this django.root var  in python code  ?
> > what in general are these PythonOptions and where do they get put ?
>
> Using the "teach a man to fish" approach: Did it occur to you to look at
> how Django does it? You already know from your Apache config that the
> Python code that handles the request is at
> django.core.handlers.modpython. Look for the use for django.root in that
> file and you'll see how you can access it from Python if you need it.

But when you do go looking, don't think that accessing 'django.root'
from mod_python PythonOption dictionary is the correct way. Look for
'SCRIPT_NAME' instead, how it is set and how you might access it. By
using 'SCRIPT_NAME' you will be portable to other hosting mechanisms
for Django as well.

Graham
--~--~---------~--~----~------------~-------~--~----~
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