Handrix
handrix at gmail.com
Mon Oct 13 09:02:30 EDT 2008
It's Ok, Thank you so much. Best regards, On Mon, Oct 13, 2008 at 12:52 PM, Jorey Bump <list at joreybump.com> wrote: > Handrix wrote, at 10/13/2008 06:37 AM: > > > When i try to execute a python script in modpython i got this error: > > NameError: name 'req' is not defined > > Give an example. Exactly how are you trying to access your script? > > > from mod_python import apache > > > > def handler(req): > > req.content_type = 'text/plain' > > req.write("Hello World!") > > return apache.OK > > > > handler(req) > > ? > > > here is my apache config > > > > <Directory "/var/www/python"> > > AddHandler python-program .py > > PythonHandler mod_python.publisher > > PythonDebug On > > </Directory> > > Your script is not a very good test of Publisher. > > > File "/var/www/python/index.py", line 8, in ? > > > > handler(req) > > What are you expecting to happen? > > Publisher already is a handler, so you don't need any special handler > code in your script (and you typically don't need to import > mod_python.apache to use it). > > Your config is fine, but your test is flawed. Create a new script called > testing.py that contains only this: > > def index(): > return '<html><body><h1>It worked!</h1></body></html>' > > Then point your browser at: > > http://your.host/testing.py/index > > If you want to write your own handler, carefully read the documentation > for your version of mod_python. > > > -- Handrix Network Engineering/Security http://securynix.co.cc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20081013/5d1b439e/attachment.html
|