|
Orr, Steve
sorr at rightnow.com
Thu Jul 30 12:40:36 EDT 2009
Running Apache 2.2.4; mod_python 3.3.1; Python 2.4.
Experiencing behavioral problems with WSGI on mod_python. I'm running the exact same code but mod_wsgi works and mod_python does not.
Here's the code which is the same in 2 files: myapp.wsgi; and myapp.py...
def application(environ, start_response):
status = '200 OK'
output = '<html><body>\n'
tbl = """<table border="5">"""
for k,v in environ.items():
tbl += "\n<tr><td>%s</td><td>%s</td></tr>" % (k,v)
tbl += "\n</table>"
curpath = environ.get('PATH_INFO', '/')
if curpath == '/maintenance/':
output += '<h1>Maintenance page</h1>'
else:
output += """<h1>Hell!! Oh... Whirled!</h1>
<a href="/myapp/maintenance/" target="_blank">Maintenance</a> <br />\n"""
output += """%(tbl)s\n</body></html>""" % locals()
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
The mod_wsgi implementation "routes" to the link properly but the mod_python version does not. With other tests it seems like environ is not in sync when using mod_python. I tried single process mode Apache and experienced the same problem.
For the mod_python handler I've tried the 2 known versions from: Nicholas Borko; and Eli Collins. Both exhibit the same behavior.
Is there some secret Apache directive needed to force mod_python to sync up? Here's how Apache is setup:
<VirtualHost modwsgi:80>
ServerName modwsgi
ServerAlias modwsgi.local
DocumentRoot /home/hydra/docroot/modwsgi
WSGIScriptAlias /myapp /home/hydra/modwsgi/myapp.wsgi
<Directory /home/hydra/docroot/modwsgi>
Order allow,deny
Allow from all
</Directory>
<Directory /home/hydra/modwsgi>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost modpython:80>
ServerName modpython
ServerAlias modpython.local
DocumentRoot /home/hydra/docroot/modwsgi
ScriptAlias /myapp /home/hydra/modwsgi/
<Directory /home/hydra/docroot/modwsgi>
Order allow,deny
Allow from all
</Directory>
<Directory /home/hydra/modwsgi>
SetHandler python-program
PythonHandler wsgi_handler
PythonOption WSGI.Application myapp::application
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Is this a handler problem or a mod_python implementation problem? Or a problem with my understanding?
What do you recommend?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20090730/ec8114ec/attachment.html
|