Could you provide more details about what didn't work for you?
Mind you, if you are using protorpc from the source code repository,
there is now a wsgi module. It contains the proper implementation of
a single URL WSGI handler (it cannot yet handle multiple mappings).
On Thu, Oct 13, 2011 at 7:16 PM, Kyle Finley <kylef...@gmail.com> wrote:
Based on what I am seeing, there might be another issue. When you
enable 2.7 and want to use it in threadsafe mode, you will need to use
"wsgi" handlers vs. "cgi" handlers. This is not a protorpc issue,
because protorpc provides wsgi implementations, including webapp.
The difference between "wsgi" and "cgi" in the app engine sense has
to do with how you define handlers. Handlers that end in ".py" are
cgi handlers, meaning the script is executed as a cgi call and your
script can handle it however it wants. One way to handle cgi requests
is using wsgi, which webapp does.
"wsgi" handlers in the app engine sense require you to define a wsgi
application. This wsgi application must then be placed in a global
variable of a module and is referred to directly in the handler. For
example:
handlers:
- url: /my_service.*
script: my_service.app
In this case, my_service refers to a module (a .py file) that
contains a cgi application object 'app'. A wsgi application can be
defined as simply as this:
my_service.py:
===========
def app(environ. start_response):
start_response('200', [('content-type', 'application/json')])
return ['{"message": "hello"}']
If you used webapp, you would call webapp.WSGIApplication to create
the application with the protorpc mappings. I would also consider
using webapp2 instead of webapp, although it has not been tested with
protorpc.
Make sense?
ProtoRPC is moving to a raw WSGI handler mode of configuration so in
the long run this incompatibility will not be an issue. For now, it's
problematic. Either use webapp 1 for ProtoRPC main scripts or use the
new wsgi module (which is not in the SDK yet, but will be soon).
Fatal error when loading application configuration: Invalid object: threadsafe cannot be enabled with CGI handler: main.py in "C:\Outils\Eclipse\workspace\ProtoRPCEchoDEMO\src\app.yaml", line 32, column 1I've tried to follow Nick's blog : http://blog.notdot.net/2011/10/Migrating-to-Python-2-7-part-1-Threadsafe
I am planning to get better support as soon as I can. Mainly, I've
been writing WSGI based ProtoRPC handlers that are not based on webapp
at all. Those will eventually be the officially supported way to
write ProtoRPC servers. You can use your own local version from the
source repository using package protorpc.wsgi.service. Unfortunately,
it does not have the ability to automatically set up a registry yet,
nor does it handle multiple urls. You would need to write your own
multi url handler or use a different wsgi handler for each service.
Should be easy to do under python 2.7 app engine.
# Map the RPC service and path (/hello)
hello_service = service.service_mapping(HelloService, '/hello.*')
def main():
util.run_wsgi_app(hello_service)
if __name__ == '__main__':
main()
# Map the RPC service and path (/hello)
app = service.service_mapping(HelloService, '/hello.*')