繁体   English   中英

Google App Engine Python 2.7启动器-Localhost显示空白页

[英]Google App Engine Python 2.7 Launcher - Localhost shows a blank page

我试图完成在线教程,却陷入了这一部分。 应用正在运行,并且端口输入正确。 浏览器将显示空白页面,而不是表单。

import webapp2

form="""
<form method="post">
What is your birthday?
<br>
<br>

<label> Month
    <input type="text" name="month">
</label>

<label> Day
    <input type="text" name="day">
</label>

<label> Year
    <input type="text" name="year">
</label>

<br>
<br>

<input type="submit">
</form>
"""

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.write(form)

    def post(self):
        user_month = valid_month(self.request.get('month'))
        user_day = valid_day(self.request.get('day'))
        user_year = valid_year(self.request.get('year'))

    if not (user_month and user_day and user_year):
        self.response.out.write(form)
    else:
        self.response.out.write("Thanks! That's a totally valid day!")

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

您是否看过GoogleAppEngineLauncher生成的日志?

您的代码中似乎有一些错误:

  • 您的post()方法中的缩进不正确。 if-else语句需要进一步缩进。
  • 我看不到valid_month函数的定义

您的日志应显示这些错误以及其他错误,并为您提供修复它们所需的信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM