使用 Google App Engine 的第一天。
我的 yaml 文件包含以下内容:
application: testProgram
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: main.py
libraries:
- name: webapp2
version: "2.5.2"
我的 python 文件包含以下内容(只是为了咯咯笑):
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.reponse.headers['Content-Type'] = 'text/plain'
self.response.out.write("Hurray for cake!")
app = webapp2.WSGIApplication([('/', MainPage)],debug=True)
我得到的错误如下:
ile "/home/rickus/google_appengine/google/appengine/api/yaml_listener.py", line 178, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: Unable to assign value 'testProgram' to attribute 'application':
Value 'testProgram' for application does not match expression '^(?:(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{0,99}[a-z\d])$'
in "testProgram/app.yaml", line 1, column 14
所以它是在提示我的文件命名?这不可能吧?我有什么想法吗?
最佳答案
这很可能是在提示你的 applicationId,看看正则表达式,它只接受小写字符。
将您的 applicationId 更改为“testprogram”或“test-program”
关于python - 谷歌应用服务器 "unable to add testProject to attribute application"正则表达式问题中的 yaml 异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39263309/