I am using apache2 and python2.6 on linux.
I know how to make apache run a *.py file, just add "AddHandler cgi-script .cgi .py" to httpd.conf file. But how to make apache2 run a *.pyc file?
Adding "AddHandler cgi-script .cgi .pyc" is not working.
I've heard that mod_python can enable both *.pyc and *.pyo run on apache. Could anybody tell me how does mod_python make it?
By the way in the current I don't want to learn mod_python or WSGI...
Thank you all in advance!
解决方案
The problem is that httpd doesn't know how to run a .pyc file, since unlike a .py file (with its shebang line), a .pyc file contains no information on how it should be run. You will need to use binfmt_misc to instruct Linux on how to run a .pyc file. And don't forget to make the file itself executable as well.