我在 google 和 stackoverflow 中进行了很多搜索,但无法弄清楚我的代码不起作用,
app.yaml 文件如下:
application: morgan629200774
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /.*
script: main.app
- url: /unit1/
script: unit1.app
- url: /unit2/
script: unit2.app
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
libraries:
- name: webapp2
version: "2.5.2"
这是我的代码:
import webapp2
form = """
<form method="post">
Enter some text to ROT13
<br>
<br>
<div><textarea name="content" rows="7" cols="50"></textarea></div>
<input type="submit" value="submit">
<br>
<br>
</form>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.out.write("main page")
class unit1(webapp2.RequestHandler):
def get(self):
self.response.out.write("hello world")
class unit2(webapp2.RequestHandler):
def get(self):
self.response.out.write(form)
self.response.out.write("hello world")
def post(self):
rot13=''
text=self.request.get('content')
rot13=text.encode('rot13')
self.response.out.write(rot13)
app = webapp2.WSGIApplication([
('/.*', MainPage),
('/unit1/', unit1),
('/unit2/', unit2)
], debug=True)
有人可以告诉我我做错了什么吗?
谢谢