I tried setting the main page '/'
for users to log in or not to log in , but I get a NotAllowedError
. This works on a local server. However, it does not work on a real public server.
Does NotAllowedError
with Google App Engine standards not to put login on cover page or maybe something else?
Here is the error:
Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__ rv = self.handle_exception(request, response, e) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__ rv = self.router.dispatch(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__ return handler.dispatch() File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch return method(*args, **kwargs) File "/base/data/home/apps/s~map-jobs/2.371277816538602179/main.py", line 294, in get user_url = users.create_login_url()
Here is my MainHandler
:
class MainHandler(BaseHandler): def get(self): user = users.get_current_user() logout_url = users.create_logout_url(self.request.uri) profile='' if user: profile = Profile.query(Profile.user_id==user.user_id()) if profile.count() <= 0: profile = Profile() profile.user_id = user.user_id() profile.email = user.email() profile.firstname = user.nickname() profile_key = profile.put() else: profile_key = Profile.query(Profile.user_id==user.user_id()) profile = profile_key.get() current_user = 'Hello, '+ user.nickname() user_url = logout_url title = "Click to logout from Google." else: current_user = 'Google Sign in' user_url = users.create_login_url(self.request.uri)
Here is part of my webapp2.WSGIApplication
:
app = webapp2.WSGIApplication([ ('/', MainHandler), ], debug=True)
Here is my app.yaml:
application: map-jobs version: 2 runtime: python27 api_version: 1 threadsafe: yes handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: /(.*\.(gif|png|jpg|js|css|woff|ttf|svg)) static_files: static/\1 upload: static/(.*\.(gif|png|jpg|js|css|woff|ttf|svg)) - url: /templates/.* script: templates.app - url: .* script: main.app libraries: - name: webapp2 version: "2.5.2" - name: jinja2 version: "2.6"