[mod_python] One question in mod_python tutorial

InitX guorong.zhang at onewaveinc.com
Thu Feb 19 22:25:24 EST 2009


Thank you for reply guys

In the preview example my webbrower display hello world then it meaning
mod_python is working for me
and I had check the permission of that folder, it is 755 meaning everyone
can read and exec the form.py file.

mptest and form got same SElinux mode
-rwxr-xr-x  51nnyy net  system_u:object_r:httpd_sys_content_t form.py
-rwxr-xr-x  51nnyy net  system_u:object_r:httpd_sys_content_t mptest.py

so any ideas?


On Thu, Feb 19, 2009 at 9:05 PM, Jorey Bump <list at joreybump.com> wrote:

> The last thing the world needs is another formmail script unleashed on
> the Internet by newbies. :)
>
> Ignore that example and try something simpler, if you're merely testing
> Publisher functionality.
>
> Create a file named hello.py:
>
> def bruce(req):
>    return "Hello, Bruce!"
>
> Now point your browser at the *function* in the module:
>
> http://host/hello.py/bruce
>
> Once you get that working, add more sophisticated code. Publisher will
> inspect the string you return and set the Content-Type to "text/plain"
> if it's plaintext and "text/html" if it looks like an HTML page:
>
> def bruce(req):
>    return "<html><body><h1>Hello, Bruce!</h1></body></html>"
>
> Make sure this is working before you try anything more sophisticated.
> Then try importing some basic modules and returning output you create
> with them. Troubleshooting smtplib at this point is a waste of time, as
> there are any number of reasons it can fail, including the presence of
> AppArmor or SELinux.
>
>
> Polo InitX wrote, at 02/19/2009 05:18 AM:
> > Hi all
> >     I'm newbie to mod_python and I follow the mod_python document step
> > by step,
> > but I can't finished the tutorial in part 3.1 "A Quick Start with the
> > Publisher Handler" .
> >
> > My firefox return the lots of Traceback messages with error: (13,
> > 'Permission denied') in last line.
> > I put the form.py file in /home/www/py directory with +x permissions
> >
> > Why would got Permission denied problem?
> >
> > Best regards
> >
> > Following is the erros messages in apache error log file
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher: Traceback (most recent call last):, referer:
> > http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File
> > "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 299, in
> > HandlerDispatch\n    result = object(req), referer:
> http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File
> > "/usr/lib64/python2.4/site-packages/mod_python/publisher.py", line 213,
> > in handler\n    published = publish_object(req, object), referer:
> > http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File
> > "/usr/lib64/python2.4/site-packages/mod_python/publisher.py", line 412,
> > in publish_object\n    return
> > publish_object(req,util.apply_fs_data(object, req.form, req=req)),
> > referer: http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File
> > "/usr/lib64/python2.4/site-packages/mod_python/util.py", line 439, in
> > apply_fs_data\n    return object(**args), referer:
> http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File "/home/www/py/form.py", line 29, in
> > email\n    conn = smtplib.SMTP(SMTP_SERVER), referer:
> http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File "/usr/lib64/python2.4/smtplib.py", line
> > 244, in __init__\n    (code, msg) = self.connect(host, port), referer:
> > http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher:   File "/usr/lib64/python2.4/smtplib.py", line
> > 306, in connect\n    raise socket.error, msg, referer:
> > http://www.51nnyy.com/
> > [Thu Feb 19 18:07:28 2009] [error] [client 192.168.0.72] PythonHandler
> > mod_python.publisher: error: (13, 'Permission denied'), referer:
> > http://www.51nnyy.com/
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20090220/099aee62/attachment.html


More information about the Mod_python mailing list