mod_wsgi / nginx 1.0.4 / web.py 0.35
I have debian server with actually old python version- Python 2.5.2 .
Tried to make web.py+nginx working thru mod_wsgi . (Why bother with
separated uwsgi wrapper if it's already in framework and server could
use it?)
So i recomplied nginx 1.0.4 from source applying latest version of
mod_wsgi from here
https://bitbucket.org/lifeeth/mod_wsgi/downloads
Used tip version which is patched for Python 2.6 which makes it's
incompatible with 2.5. So i revert /*tp_version_tag*/ change to make
it makeable on my python headers ;)
So i am having nginx config like this:
; ======== CONFIG START =======
wsgi_python_executable /usr/bin/python;
server {
listen 127.1:80;
server_name foo.bar;
root /foo/;
include uwsgi_params;
location / {
wsgi_pass /foo/app.py;
}
}
; END
Once I aproach page thru nginx i am getting this errors in log:
*12 File "/foo/web/application.py", line 273, in wsgi
*12 if web.ctx.method.upper != web.ctx.method:
*12 AttributeError: 'NoneType' object has no attribute 'upper'
I went to /foo/web/application.py and added
if not web.ctx.method:
web.ctx.method = "GET"
Before
if web.ctx.method.upper() != web.ctx.method:
raise web.nomethod()
After that my script starts to work. But I wonder will it work on more
complicated cases for i.e. with POST request. Since I actually made a
hack.
Why web.ctx.method could be unset? Is it nginx mod_wsgi problem? Or
it's web.py wsgi representation thing?
Any ideas?
Script it'self pretty simple:
$ cat /foo/app.py
import sys, os
abspath = os.path.dirname(__file__)
sys.path.append(abspath)
import web
urls = (
'/(.*)', 'hello'
)
app = web.application(urls, globals())
class hello:
def GET(self, name):
if not name:
name = 'World'
return 'Hello, ' + name + '!'
application = app.wsgifunc()
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.