Configure Python to work in WAMP
I use WAMP to develop my PHP/MySQL applications locally before moving them to a production server. I want to start teaching myself Python and wish to add Python to my installation. I have downloaded and installed Python 2.5 and also installed mod_python. Unfortunately getting Apache to recognize that Python is installed and run Python web pages isn't working. I either get a Python error or the contents of the Python file display on the screen.
Has anyone had any luck getting Python to work with WAMP specifically? If not any experience getting it to work with Apache on Windows would be appreciated.
Here is the error message I get:
MOD_PYTHON ERROR
ProcessId: 800
Interpreter: 'localhost'
ServerName: 'localhost'
DocumentRoot: 'C:/wamp/www/'
URI: '/python/index.py'
Location: None
Directory: 'C:/wamp/www/'
Filename: 'C:/wamp/www/python/index.py'
PathInfo: None
Phase: 'PythonHandler'
Handler: 'index.py'
Traceback (most recent call last):
File "C:\wamp\bin\python\Lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "C:\wamp\bin\python\Lib\site-packages\mod_python\importer.py", line 1202, in _process_target
module = import_module(module_name, path=path)
File "C:\wamp\bin\python\Lib\site-packages\mod_python\importer.py", line 304, in import_module
return __import__(module_name, {}, {}, ['*'])
ImportError: No module named index.py
Here is the code in index.py
from mod_python import apache
def handler(req):
req.content_type = "text/plain"
req.write("Hello World!")
return apache.OK
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
Update: I changed PythonHandler to say PythonHandler mod_python.publisher in my http.conf file and that solved my other errors. But now I get a 404 error for index.py which is definitely in the right place.
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38