我正在 www.udacity.com 上关注 Web 开发 (cs253),突然开始出现错误:这是我第一次从事 Web 开发。
在成功遵循 Google App Engine 网站上的“hello world”教程(根据 Udacity 上的视频类(class)的建议)后,我开始进行一些小的更改,并不断重新提交更新的修改版本,直到我开始 4 或 5 次之后出现以下错误:
Error: Server Error
The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
我尝试 (1) 等待一段时间然后重试,(2) 重新加载最新版本,(3) 重新加载已知可以工作的上一个版本,(4) 清理 Chrome 的历史记录(我正在运行MacOS Lion 版本 10.7.5) -> 没有。我仍然遇到同样的错误。
知道我做错了什么吗?谢谢:欢迎任何帮助!
最后一件事:我正在使用 Python 2.7(不确定这是否重要,但仍然如此。)
<小时/>PS:代码如下:
helloworld.py
import webapp2
form="
<form action="http://www.google.com/search">
<input name="q">
<input type="submit">
</form>
"""
class MainPage(webapp2.RequestHandler):
def get(self):
# self.response.headers['Content-Type'] = 'text/html'
# self.response.out.write('Hello, Udacity!!')
self.response.out.write(form)
app = webapp2.WSGIApplication([('/', MainPage)], debug=True)
app.yaml
application: chris73it-helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld.app
就是这样:只有 2 个文件。
问题已解决:编辑代码时 3 个双引号中的 2 个消失了:现在可以使用了。不幸的是,因为这是我在 SO 上的第一篇文章,所以我不允许“给予 +1 分”:-( 抱歉!
最佳答案
在 form=
之后,您实际上只有一个 "
还是只是复制粘贴错误。因为您应该有 """
匹配第 8 行的收盘引号。
关于python - 为什么我在使用 Google App Engine 教程时遇到服务器错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13207045/