Hello iam尝试创建一个表单来接收用户的输入并在网页上使用python在谷歌应用引擎上查看它yaml文件内容
application: myapp
version: alpha-001
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
script: home.app
主文件的内容
import webapp2
form = """
<form action="/testform">
<input name='q'>
<input type='submit'>
</form>
"""
class Mainpage(webapp2.RequestHandler):
def get(self):
self.response.out.write(form)
class TestHandler(webapp2.RequestHandler):
def get(self):
q = self.request.get('q')
self.response.out.write(q)
app = webapp2.WSGIApplication([('/',Mainpage),('/testform',TestHandler)],debug=True)
这给了我一个错误
The url "/testform" does not match any handlers.
我想知道错误在哪里
答案 0 :(得分:4)
查看app.yaml
handlers:
- url: /
script: home.app
唯一处理的网址是/
。您希望home.app处理所有网址,我想,在这种情况下,将/
更改为.*
,如下所示:
handlers:
- url: .*
script: home.app
或者,如果你想要它们,你也可以做
handlers:
- url: /
script: home.app
- url: /testform
script: home.app