python - AppEngine confusion - CGI, WSGI-compliant? -
python - AppEngine confusion - CGI, WSGI-compliant? -
i'm confused.
if appengine supposed allow running of wsgi-employing apps ..
# somewhere in webapp.requesthandler env = dict(os.environ.items()) key, value in env.items(): self.response.out.write(key+': '+value+'<br/>') req_uri = wsgiref.util.request_uri(env)
.. why env
not contain variables pep 333 lists must-be-present -- causing wsgiref.util.request_uri()
raise keyerror
?
i'm writing libraries need work either appengine or typical apache + modwsgi setup. thought plenty write wsgi
compliant app, seems appengine .. not?
the environ
must contain wsgi specific keys environ passed wsgi application callable. pep-333 not require value os.environ
. cgi applications find many of keys in os.environ
, because gateway server has provided them, , cgi wsgi gateway interface (say, wsgiref.handlers.cgihandler
,) need add together wsgi specific keys before calling wsgi application.
to clear, when pep-333 mentions environ
, does not mean os.environ
.
edit: google.appengine.ext.webapp.request
apparently inherits webob.request
. thus, webapp handler can access wsgi environ
so.
class mainpage(webapp.requesthandler): def get(self): dosomethingwith(self.request.environ)
python google-app-engine wsgi wsgiref
Comments
Post a Comment