Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

threadsafe cannot be enabled with CGI handler

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?

like image 314
areke Avatar asked Nov 28 '22 07:11

areke


1 Answers

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.

like image 194
Ümit Avatar answered Dec 16 '22 02:12

Ümit