views:

114

answers:

1

The situation is:
I have Apache with mod_python on windows xp and my django project is not in the document root.
The Django project location is defined with the tag. The django.root ist also defined there.
All the urls work fine in the built-in server but unfortunately not in Apache. In some urls, especially the ones not pointing to the admin do not work. The django.root part gets cut off.
How can I avoid this ?

One solution could be to set the django-project into Apache's document-root. Are there other solutions?

+1  A: 

Django will use the django.root part correctly if you compose links in the template files with {% url %} tags and by calling reverse() in your HTTPResponseRedirects() calls.

Its value is stored in HttpRequest - request.META['SCRIPT_NAME'] and you can use it also in templates with:

    {% if user.is_staff %}
    <li>
        <a href="{{ request.META.SCRIPT_NAME }}/admin">Administration</a>
    </li>
    {% endif %}
graag