python - 简单的 GET-POST 回复

标签 python html google-app-engine

无法弄清楚这一点,对某人来说应该很容易。只是收到 500 服务器错误回复并期望它显示“成功”。

import webapp2
page = """
<!DOCTYPE html>
<html>
  <form method="post">
    <input type="hidden" value="success" name="radius" >
    <input type="submit">
</form>
  </body>
</html>
"""
class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.out.write(page)
    def post(self):
        radius = self.request.get("radius")
        self.response.out.write(radius)

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

app.yaml如下

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

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

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.1"

最佳答案

当我使用这个 app.yaml 运行确切的代码时,它似乎可以工作。按下后会出现一个按钮,您会收到成功消息。

application: stackquestion
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: main.app

你能发布你的app.yaml吗?

关于python - 简单的 GET-POST 回复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12437309/

相关文章:

使用 GAE 和 Google Cloud SQL 的 PhP

google-app-engine - 在 golang 中将字符串转换为 json,反之亦然?

python - 从大文件中获取单词,使用Python中的低内存

python - 如何准确地以编程方式复制粘贴内容?

html - Firefox 中的无限连接循环

javascript - 使用js/html5开始游戏开发

google-app-engine - 如何将 Google App Engine 与我自己的裸域(不是子域)一起使用?

python - python函数参数中的相等性是什么意思?

python 向特定行插入一行(大文件)

html - 在表格数据中并排对齐 div - CSS