GAE: Error 404 when creating a new script

综合编程 2018-03-21

I'm using Google App Engine with Python environment.

I have my main code in the file. I want to create a new .py file for a different page. I created the .py file, added the path to the yaml file. But I still get a '404 Error, resource not found'.

Here is my yaml file

application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: yes

- url: .*

- url: /hello

- name: webapp2
  version: "2.5.2"

When the user goes to I want the file to be executed.

Here's the current content of

import webapp2

class HeyPage(webapp2.RequestHandler):
  def get(self):
      self.response.headers['Content-Type'] = 'text/html'
      self.response.out.write('Hello, All!')

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

Here is the log:

INFO     2014-01-10 06:15:31,150] default: "GET /hello HTTP/1.1" 404 154

You should list your handlers from most specific to least specific. Your handler:

- url: .*

basically says that
should handle every url. Since it is the first in the list,
will try to handle every request regardless of the handlers that follow it in app.yaml
. Change it to:

- url: /hello

- url: .*

And all should work.


resolve hostnames to ip address using pydns module I wrote another script to change the desired nameserver. previously i used socket module to do resolution but i did not know how i can change the name...
Brief YAML reference There is no official YAML reference guide. The YAML website only offers the YAML specification , which is a dense and thorny tome clearly aimed at...
Making Pictures Worth 1000 Words in Python In a previous post, I showed how you could upload images into a Discord server from Python ; leveraging the popular chat platform to simplify things ...
Python vs. Ruby vs. Node.js – Which platform is a ... You’ve got a fascinating web app project on paper. And the tool you use to bring it to life will shape future success. On that account, it’s always...
PHP vs Python – Deciding Which Language to Use as ... The PHP vs Python debate on which programming language to learn happens every day among students, professors, and web design professionals. Deciding w...