Running python with apache + speed

mike hemkond at hotmail.com
Thu Mar 16 06:51:06 EST 2000


- I have installed Apache 1.3.12 with Python 1.5.2 on an NT Workstation 4.
- I added the following lines to srm.conf:

ScriptAlias /python/ "d:/util/Python/"
AddType application/x-httpd-python .py
AddType application/x-httpd-python .pyc
Action application/x-httpd-python "/python/python.exe"

- Running the following script through a web browser produces a 500 error.

#!d:\util\Python\python.exe
print "Content-type: text/html"
print
print "<head>"
...

- The apache log file gives:
[Thu Mar 16 13:37:06 2000] [error] [client 127.0.0.1] Premature end of
script headers: d:/util/python/python.exe

- I can see that apache is running python (using a process monitor) so it
should not be a security issue (I guess). I installed PHP successfuly
without any security configurations, so it should be the same for python.

- Browsing the newsgroups I saw people saying that it is a problem with
headers, but when running through command line it seems fine, plus I tried
changing the code into \n, \r\n\r\n etc no luck.

- My final guess is that it has something to do with buffering (as the
documentation says) but I can't find any setup in python for that. BTW:
adding sys.stdout.flush() at the end of the script didn't help.


+ Does anybody know if mod_python can be made to work under WINNT ? I need
python to run fast under linux/nt.

thanks for your help,
mike.






More information about the Python-list mailing list