[Debian] Mod-python not working
I can not get mod-python to work on my server. Everytime I load a page which is supposed to execute python code, my browser offers to save the file (*.py)
Example .py file I tried: # /var/www/html/helloworld.py from mod_python import apache def handler(req): req.content_type = "text/html" req.write("Hello World! Blarg!") return apache.OK PS: Mod-python was installed using Aptitude. I run Apache 1.3 together with mod-php and phpmyadmin, all of which work (finally ;)) Can anybody please help me? Which files did I forget to edit, etc? |
hey! What are you doing with modpython?
I use ubuntu, apache 1.3 and mod_python 2.7 for some intranet application By the way, please tell me if you know how to accept arguments in common python handler. (I know how to do it in mp2 publisher or mp3 both handlers) active modpython in apache: dpkg-reconfigure apache Code:
=== httpd.conf === |
I tried, and got this:
Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 193, in Dispatch result = object(req) File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line 133, in handler module = apache.import_module(module_name, _req, [path]) File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 335, in import_module module = imp.load_module(mname, f, p, d) File "/var/www/icr.py", line 6, in ? from mx.DateTime import now ImportError: No module named mx.DateTime |
if you see those message, it is working now!
my program use mxDateTiem and pysqlite but you may not need them. try to replace icr.py with these lines. Code:
def index(req): |
It works, thanks al lot !
( now I'm gonna find out why it now does work ) |
it wasn't working because you have not enable mod_python in /etc/apache/modules.conf, by running dpkg-reconfigure apache you did it.
In post #3, the messages you mentioned is actually debug code, it was running correctly |
All times are GMT -5. The time now is 12:06 PM. |