问题
I created an Google App Engine project using Webapp2 everything was working well three days ago but today (now) surprised that it is misbehaving it sometimes saying
The requested URL / was not found on this server
then if I reload the url in the browser a number of times like 10 times. I can see my website.
It redirect the user to login in their Google Account then checks if the user is registered and give personalized content or an information. Trying reloading again in the browser it leads to
The requested URL / was not found on this server.
What is going on? Is it caused by the location chosen when making a Google Cloud Project, there was no Africa in the choices so I chose the nearby zone!
The misbehaving url is this though it if it loads it may check if your email is registered first...
This is app.yaml
file:
application: cngiramicroloanscentre
version: alpha
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /
script: cngira.app
login: required
- url: /loanee/.*
script: loanee.app
login: required
- url: /officers
script: officers.app
login: required
- url: /loanees
script: loanees.app
login: required
- url: /loanees/.*
script: loanees.app
login: required
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: "2.6"
- name: markupsafe
version: "0.15"
The part of code that route in cngira.py
is:
....
app= webapp2.WSGIApplication([('/',MainPage)],debug=True)
The class MainPage is:
class MainPage(webapp2.RequestHandler):
"""docstring for MainPage"""
def get(self):
user=users.get_current_user()
user_email=user.email()
fetched_user=(ndb.Key("Officer",user_email)).get()
if(fetched_user==None and user_email != "johnnnoni@gmail.com" and user_email != "barakarichard1992@gmail.com"):
self.response.out.write("Sorry you are not authorised to access this place yet consult the authorised to add you to add you!! "+user_email)
else:
template_in=template_env.get_template("templates/index.html")
if(user_email=="johnnnoni@gmail.com" or user_email == "barakarichard1992@gmail.com"):
dictionary_to_pass={"navigations":navigations}
self.response.out.write(template_in.render(dictionary_to_pass))
else:
self.response.out.write(template_in.render( { "navigations":navigation_for_officer } ))
回答1:
The 404 page displayed in this case was not the typical one for a 404 error coming from the application, but the "broken robot",
- That’s an error.
The requested URL was not found on this server. That’s all we know.
one provided by the Google infrastructure:
This is typically an indication that the GAE infrastructure was unable to determine from the request the proper application instance to start (if needed) and pass the request to for processing. The request didn't even reach the application code.
Usually that indicates some sort of application configuration problem or, in rare cases, an outage in the GAE/Google hosting infrastructure.
As OP's comments indicate, deleting the project and creating a new one instead fixed the problem in this instance. A rather radical approach - the project identifier can't be re-used, deleting the old project might not be considered acceptable in some cases.
But cloning the application config+code in a new (temporary) project just to double-check is always something to try - if the new project works as expected contacting Google's support is probably needed to repair the old project.
来源:https://stackoverflow.com/questions/49960123/google-app-engine-the-requested-url-was-not-found-on-this-server-not-always