[mod_python] mod_python tutorial issues

Nilesh Govindrajan admin at itech7.com
Mon Mar 17 11:15:17 EDT 2008


Joseph Sliz wrote:
> Still didn't work.  I tried visiting http://localhost/hello.py/handler, but
> still receive an "HTTP 404 Not Found" error.  What could I possibly be
> missing???
>
> Regards....Joe
>
> -----Original Message-----
> From: Nilesh Govindrajan [mailto:admin at itech7.com] 
> Sent: Monday, March 17, 2008 11:02 AM
> To: jsliz at fluentenergy.com
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] mod_python tutorial issues
>
> Joseph Sliz wrote:
>   
>> Nilesh;
>>
>> I've changed the following code in the Apache httpd.conf file:
>>
>> DocumentRoot /C:/temp
>> <Directory /C:/temp>
>>     AddHandler mod_python .py
>>     SetHandler mod_python 
>>     PythonHandler hello
>> </Directory>
>>
>> But, I am still receiving an "HTTP 404 Not Found" error when I put the
>> request "http://localhost/hello.py" into my browser.  Should I be placing
>> the above piece of code in a certain spot in the Apache httpd.conf file???
>>
>> Regards.....Joe
>>
>> -----Original Message-----
>> From: Nilesh Govindrajan [mailto:admin at itech7.com] 
>> Sent: Monday, March 17, 2008 10:41 AM
>> To: jsliz at fluentenergy.com
>> Cc: mod_python at modpython.org
>> Subject: Re: [mod_python] mod_python tutorial issues
>>
>> Joseph Sliz wrote:
>>   
>>     
>>> I am new to mod_python and Apache.
>>>
>>> My environment is:
>>>  
>>> Windows XP Prof sp2
>>> Python 2.4
>>> Apache 2.2.8
>>> Mod_python 3.3.1
>>>  
>>> I've already added the following to the Apache httpd.conf
>>>  
>>> LoadModule python_module modules/mod_python.so
>>>  
>>> I'm now trying to do a simple test, following a tutorial I found.  I've
>>>     
>>>       
>> also added the following to the Apache httpd.conf file to let Mod_python
>> know where to find my python module
>>   
>>     
>>>  
>>> DocumentRoot /C:/temp
>>> <Directory /C:/temp>
>>>     AddHandler python-program .py 
>>>     PythonHandler hello
>>> </Directory>
>>>  
>>>  
>>> I have added the following python script to my "C:/temp" directory.
>>>  
>>> from mod_python import apache
>>>  
>>> def handler(req):
>>>      req.content_type = "text/plain"
>>>      req.send_http_header()
>>>      req.write("Hello, Welcome to my World!")
>>>      return apache.OK
>>>  
>>>  
>>> When I put the request "http://localhost/hello.py" into my browser, I
>>>     
>>>       
>> receive an "HTTP 404 Not Found" error.  Can anyone please give me some
>> assistance as to what I might be doing wrong??
>>   
>>     
>>>  
>>> Reqards..Joe
>>>  
>>> / /
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Mod_python mailing list
>>> Mod_python at modpython.org
>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>   
>>>     
>>>       
>> Try with
>>
>> AddHandler mod_python .py
>>
>> and
>>
>> SetHandler mod_python
>>
>> note: you must AddHandler first otherwise it won't work.
>>
>>   
>>     
>
> try visiting http://localhost/hello.py/handler
>
> if it works;
>
> then add this code in hello.py
>
> def index(req):
> return handler(req)
>
>   
Are you sure that the directory is set correctly ? /C: ???
I am on Linux so don't know much about Apache in Windows.


More information about the Mod_python mailing list