threadsafe cannot be enabled with CGI handler

google-app-engine, python

Solution

This has nothing to do with OpenID.

If you use the new Concurrent Requests (threadsafe=true) mode with python 2.7 in Google App Engine you have to make sure that you specify a WSGI application (e.g. myapp.app) instead of a CGI handler (e.g. myapp.py) in app.yaml (see here for more details):

Looks something like this:

app.yaml:

application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
   - url: /.*
    script: myapp.app

main.py:

import webapp2

class MainPage(webapp2.RequestHandler):
  def get(self):
    self.response.headers['Content-Type'] = 'text/plain'
    self.response.out.write('Hello, WebApp World!')

app = webapp2.WSGIApplication([('/', MainPage)])

""" Old code:
def main():
  run_wsgi_app(app)

if __name__ == '__main__':
  main()
"""

Alternatively you can also disable concurrent requests (threadsafe=false) and use your old CGI handler.

Problem

I've been trying to follow this turorial in order to implement openID authentication on an app, but I am completely lost. No matter what I tried, I kept getting this error: ``` Fatal error when loading application configuration: Invalid object: threadsafe cannot be enabled with CGI handler: main.py ``` Does anyone know how to implement openID logins?

Original source

Related problems