【发布时间】:2015-07-14 19:23:56
【问题描述】:
我一直在使用 udacity.com 来学习编程,但我的代码(python)遇到了一些问题。该应用程序是发布的,以允许记下您出生的那一天,当您推送提交时,它的发布是说“谢谢,这是一个完全有效的日子!”。它没有这样做。应用程序再次重新启动。有人能告诉我为什么 is 语句不起作用以及如何解决它。
import webapp2
form="""
<form>
What is your birthday?
<br>
<label>Month<input type="type" name="month"></label>
<label>Day<input type="type" name="day"></label>
<label>Year<input type="type" name="year"></label>
<div style="color: red">%(error)s</div>
<br>
<br>
<input type="submit">
</form>
"""
class MainPage(webapp2.RequestHandler):
def write_form(self, error=""):
self.response.out.write(form % {"error": error} )
def get(self):
self.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_month and user_year):
self.write_form("That doesn't look valid to me, friend.")
else:
self.response.out.write("Thanks! That's a totally valid day!")
app = webapp2.WSGIApplication([('/',MainPage)], debug=True)
【问题讨论】:
-
您的配置很可能是不正确的,但这只是猜测,因为其他人尝试回答也是如此。这里没有具体的问题来实际回答,它基本上说我的东西不起作用。您的问题不是其他人可以解决的,而是您缺乏信息。 不鼓励链接到外部资源,尤其是第三部分托管的图像,因为它会导致死链接和无用的问题和答案。
-
我的问题是,为什么将要发布的一段代码放入 Google 应用引擎 locahost 时会出现空白。恳请各位大侠帮忙看看有没有错误或遗漏类型。
-
通常 App Engine 端口是 8080 而不是 9080。
-
我把 localhost 改成 8080 还是空白
-
你们有在谷歌应用引擎上使用python的经验
标签: python-2.7 google-app-engine