getting the path in a cgi script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kalle Anke

    #1

    getting the path in a cgi script

    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



    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.p ath_info();

    but how do I do it in python?

  • Fredrik Lundh

    #2
    Re: getting the path in a cgi script

    Kalle Anke wrote:
    [color=blue]
    > 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.p ath_info();
    >
    > but how do I do it in python?[/color]

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

    </F>



    Comment

    • Kalle Anke

      #3
      Re: getting the path in a cgi script

      On Fri, 14 Oct 2005 18:20:10 +0200, Fredrik Lundh wrote
      (in article <mailman.2074.1 129306980.509.p ython-list@python.org >):
      [color=blue]
      > import os
      > path_info = os.environ.get( "PATH_INFO" )[/color]

      Tackar ... det var nåt enkelt det mindes jag :-)

      Comment

      Working...