uri = request.META.get('REQUEST_URI') or request.META.get('PATH_INFO')
When I use this expression in the test server, which uses the
request.META.get('PATH_INFO'), everything is fine but at production
server (apache, mod_python) the value of
request.META.get('REQUEST_URI') is always '/' for any url like 'http://
domain.com/something/'
Thanks for any help...
uri = request.META.get('PATH_INFO')
This is also a point of inconvenience and I think the test server
should be made more compatible with apache.
Apache is not the only web server in the world, so it is a good thing
that we don't behave like an Apache clone. It forces you not to rely on
peculiarities of one particular implementation. Also, remember that you
are interacting with mod_python, rather than Apache itself, so there is
a layer between you and the webserver proper that you will also have to
look at the documentation for.
On the Django side, have a look in django/core/handlers/ at modpython.py
and wsgi.py and you'll see how we populate the META variable in both
cases. As you can see there, a lot of the information, including the two
variables you are interested in, we simply copy directly from the
information provided by the server -- be it a WSGI-compatible
implementation or modpython.
After familiarising yourself with that code, you can then look further
into why you are not receiving the information you are after from the
web server in whichever setup you prefer.
Regards,
Malcolm
Because of the way mod_python hooks into Apache and the way people
then use that, you cannot rely on the value of SCRIPT_NAME and
PATH_INFO being correct. Even third party WSGI adapters which work on
top of mod_python don't necessarily set them correctly without some
hack involving the user manually specifying what the original
application mount point was. This situation could be improved if
direct adapters or WSGI adapters for mod_python made use of some new
APIs within the mod_python 3.3 core to properly determine the mount
point, but this will not help if you are using older versions of
mod_python.
If you wish to play with some pre-release code, the only WSGI system
for Apache (in the style of mod_python), that sets SCRIPT_NAME and
PATH_INFO correctly is mod_wsgi (http://www.modwsgi.org).
Graham