[mod_python] Environment variables created by Apache not in os.environ

Gregory (Grisha) Trubetskoy grisha at modpython.org
Sat Sep 8 19:20:55 EST 2001


The mod_python cgihandler fakes the environment - it's just a dictionary
built for every request that contains all the standard cgi variables. If
mod_rewrite tries to set real environment variables your will not see
them.

It's a small sacrifice I had to make because access to the real
environment leaked memory, which is a serious problem for mod_python since
it runs inside the Apache process.

The thing to do in your case is probably to do whatever it is that
mod_rewrite does inside your cgi script instead.

Grisha

On Mon, 3 Sep 2001, Keegan Miller wrote:

> I'm working on a system which was working with Python as a CGI handler.
> After switching to mod_python, most of it works.  But the site depends on
> some environment variables which are extracted from the URL by Apache's
> mod_rewrite module.  For some reason, these environment variables aren't
> loaded into os.environ.
>
> Does anyone know how I can access these variables?
>
> When this module was running as a CGI script, the env vars were there.  Now,
> system vars like OS are there, but the ones created by mod_rewrite are not.
>
> I'm running Apache 1.3.20, Python 2.1, and mod_python 2.7.4 on Windows 2000.
>
> Thanks.
> Keegan Miller
>
>




More information about the Mod_python mailing list