how to run python scripts on a website

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

    #1

    how to run python scripts on a website

    i have a website which runs apache on linux. it supports python (i
    think via cgi....not sure how else). anyway how can I go to a web page
    and run a python script or something like that? for example say i make
    a script which prints out all the links on another URL....how can i run
    that?


    thanks!

  • James Stroud

    #2
    Re: how to run python scripts on a website

    py wrote:[color=blue]
    > i have a website which runs apache on linux. it supports python (i
    > think via cgi....not sure how else). anyway how can I go to a web page
    > and run a python script or something like that? for example say i make
    > a script which prints out all the links on another URL....how can i run
    > that?
    >
    >
    > thanks!
    >[/color]

    Here is a start. Put the following in your cgi-bin folder or equivalent.
    Name it test.cgi


    #!/usr/bin/python

    print "Content-Type: text/plain\n\n"
    print "Hello, World!\n"


    Now just browse it. E.g.:




    James

    Comment

    • Christoph Zwerschke

      #3
      Re: how to run python scripts on a website

      py schrieb:[color=blue]
      > i have a website which runs apache on linux. it supports python (i
      > think via cgi....not sure how else). anyway how can I go to a web page
      > and run a python script or something like that? for example say i make
      > a script which prints out all the links on another URL....how can i run
      > that?[/color]

      Here is an audio introduction to CGI programming with Python:


      Comment

      Working...