Hi,

I was trying to set up a site at a URL that is not at the root of the web
server.  I am using mod_python, and my apache config looks similar to that
included with the relevant django documentation, which I'll duplicate here:

[from http://www.djangoproject.com/documentation/modpython/]

--------------------------------------------------------------------------------
<Location "/mysite/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonDebug On
</Location>
--------------------------------------------------------------------------------

That documentation correctly adds:

"Restart Apache, and any request to /mysite/ or below will be served by Django.
Note that Django’s URLconfs won’t trim the “/mysite/” — they get passed the full
URL."

So, the problem is that I have to update my urls.py to include the /mysite/
prefix in all URLs.

This is clearly not very DRY.  For me, the biggest pain is that I'm actually
trying to deploy the same project at two different URLs (with different host
parts, too).  (I have reasons to do this, although they aren't incrediblly
relevevant, so I won't go into that).  Since my urls.py has to be so aware of my
apache config, I can't do things the way I want to and use the apache config to
enable & disable access to different application fragments under each base URL.

All of this could be fixed by simply changing ModPythonRequest
(django/core/handlers/modpython.py) to use req.path_info instead of req.uri.  Is
there any reason not to do that (aside from breaking backwards compatibility)?

If a change like this is in order, I assume it will be made prior to 1.0.  What
do people think about this?  I didn't get much from a Google search, but it
seems hard to believe that it hasn't come up yet in the past.

If this can be solved using some crazy middleware-type solution, I'd be open to
that.  It doesn't seem ideal to me for the current behavior to be the default,
though.

-Forest

Attachment: signature.asc
Description: Digital signature

Reply via email to