Python web server

Paul Boddie paul at
Sat Jun 24 09:43:43 EDT 2006

arvind wrote:
> When I run the script on server,only HTML part gets executed.
> But the python code appears as it is on the screen in the text format.
> How to run the CGI script on web server using Python2.4.3?

We don't have much specific information from you here, but taking a few
guesses, it sounds like you have put a Python program in some directory
that your Web server knows about, but when you visit the address in
your browser that should let you use that program, you just see the
program text, not the output of the program when it is run.

What you need to do is to tell your Web server that the file is a
"script". With Apache, for example, instead of using configuration
directives like "Alias", you use "ScriptAlias" instead. Of course,
Apache has lots of different ways to make files behave like scripts,
and you may be using a completely different Web server, so a bit more
information would be welcome.

Still, one really simple method with Apache is to expose your program
like this:

ScriptAlias /myprogram "/home/me/programs/"

Provided you set the permissions of to be readable and
executable by the Web server user (if appropriate), and provided the
Web server user can navigate to the /home/me/programs directory, you
should at least get the program running. More configuration may be
needed - why not let us know how far you get?


More information about the Python-list mailing list