ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Configuring apache to execute python scripts using mod_python handler
by Jeffmess@Gmail.Com other posts by this author
Aug 13 2007 7:12AM messages near this date
Re: Configuring apache to execute python scripts using mod_python handler | Air conditioners for free!??!?!!!
Hi Joe

You'd probably have better luck posting this to the mod python mailing
list. Did you name your python script mptest.py and did you remember
to restart Apache when you edited the httpd.conf file? If so then I
don't see any reason why it shouldn't work although I've never tried
mod_python under a Windows environment.

Regards

Jeffrey van Aswegen

joe jacob wrote:
>  I configured apache to execute python scripts using mod_python
>  handler. I followed below mentioned steps to configure apache.
> 
>  1. In http.conf I added
> 
>    <Directory "D:/softwares/Apache2.2/htdocs">
>    AddHandler mod_python .py
>    PythonHandler mptest
>    PythonDebug On
>    </Directory>
> 
>  2. Then I added the line "LoadModule python_module modules/
>  mod_python.so" to http.conf.
> 
>  Then I tried execute the python script mentioned below from browser.
> 
>  from mod_python import apache
>  def handler(req):
>  req.content_type = 'text/plain'
>  req.write("Hello World!")
>  return apache.OK
> 
>  Then I am getting the following error
> 
>  Traceback (most recent call last):
> 
>    File "D:\softwares\Python25\Lib\site-packages\mod_python
>  \importer.py", line 1537, in HandlerDispatch
>      default=default_handler, arg=req, silent=hlist.silent)
> 
>    File "D:\softwares\Python25\Lib\site-packages\mod_python
>  \importer.py", line 1202, in _process_target
>      module = import_module(module_name, path=path)
> 
>    File "D:\softwares\Python25\Lib\site-packages\mod_python
>  \importer.py", line 304, in import_module
>      return __import__(module_name, {}, {}, ['*'])
> 
>  ImportError: No module named mptest
> 
>  I am using Apache 2.2.4, python 2.5 and mod_python-3.3.1.win32-py2.5-
>  Apache2.2.
> 
>  I am able to execute python scripts by configuring apache to execute
>  the cgi scripts. But I want to execute it using mod_python as it is
>  faster compared to cgi mode. Someone please help me on this issue.

-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
Joe Jacob
7stud
Jeffmess@Gmail.Com

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved