1

im getting a bit stuck regarding options for running python scripts on my server. From the research ive done so far, i can see i need to modify apache slightly to run python scripts, by using either mod_wsgi or mod_python. Two issues i have:

mod_python doesnt appear to be maintained anymore (last release, 2007) mod_wsgi appears to require modification of my httpd.conf file on a per application basis.

What im wanting to know, is there a way of getting python scripts to run in the same way as php, i.e. just by going to index.py etc... or is it more involved than that?

At present im just trying to set it up on my xampp install.

Any help would be appreciated.

0

4 Answers 4

3

I would stick with mod_wsgi. It seems more actively maintained. There are good docs for it on the project page. If you want mod_wsgi to handle your .py scripts, you can add something like:

AddHandler wsgi-script .py

In the appropriate context in Apache. There are configuration instructions and installation instructions that should really help.

1

You can simply run Python scripts as CGI, if you really want - just add .py as a CGI handler in your Apache conf:

AddHandler cgi-script .cgi

Note that this is a very bad idea other than for very low-usage applications, as it is slow and inefficient. You really are much better off going with mod_wsgi.

1

One can do a once off configuration of mod_wsgi which then allows you to add applications without needing to go back and modify the configuration again. As someone else mentioned, this revolves around using AddHandler instead of WSGIScriptAlias. See:

http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines

BTW, you probably want to look at a higher level framework or library of WSGI components rather than work with raw WSGI. For example, see:

http://werkzeug.pocoo.org/

http://flask.pocoo.org/

There are lots of others referenced at:

http://www.wsgi.org/wsgi/Frameworks

0

I posted simple tutorial of how to install python for XAMPP on my blog. Let me know if you found it useful.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .