getting the path in a cgi script

Fredrik Lundh fredrik at pythonware.com
Fri Oct 14 12:20:10 EDT 2005


Kalle Anke wrote:

> I know I've done this once before ... I think ... but now I can't figure out
> how to do it
>
> I've set my web server to use an alias similar to this
>
>    ScriptAlias /xx/ "/Library/WebServer/CGI-Executables/xxx.cgi/"
>
> which makes it possible for me to write
>
>    http://127.0.0.1/xx/some/kind/of/path
>
> my problem is that I don't know how to get the 'some/kind/of/path' part of
> the URL in my script.
>
> I know that I can do like this in perl
>
>    $documentRoot.path_info();
>
> but how do I do it in python?

import os
path_info = os.environ.get("PATH_INFO")

</F>






More information about the Python-list mailing list