4

我正在尝试创建一个简单的 Web 应用程序,上面写着 Hello Udacity 并将其上传到 Google App Engine,但我不断收到一堆错误。

来自 Google App Engine 的错误消息:

11:57 PM Host: appengine.google.com
Error parsing yaml file:
Unable to assign value 'udacityassignment2' to attribute 'url':
Value 'udacityassignment2' for url does not match expression '^(?:(?!\^)/.*|\..*|(\(.).*(?!\$).)$'
  in "C:\Users\Wealthy\Desktop\ambhelloworld\udacityassignment2\app.yaml", line 12, column 8
2013-05-27 23:57:00 (Process exited with code 1)

You can close this window now.

应用程序.yaml:

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

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: udacityassignment2
  script: main.app

libraries:
- name: webapp2
  version: "2.5.2"

主要.py:

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello Udacity!')

app = webapp2.WSGIApplication([
    ('/', MainHandler)
], debug=True)

谷歌应用引擎控制台:

Error: Not Found
The requested URL / was not found on this server.

任何有关如何纠正此问题的帮助将不胜感激。

4

2 回答 2

4

该错误表明url您的 app.yaml 中的条目无效。尝试这个

url: /udacityassignment2

正如蒂姆指出的那样,映射应该是

app = webapp2.WSGIApplication([
    ('/udacityassignment2', MainHandler)
], debug=True)
于 2013-05-28T04:22:42.517 回答
0

您可以按如下方式输入 URL,以便在创建 url 路由表时更加灵活

- url: .*
  script: main.app
于 2013-06-07T04:06:28.533 回答