2012-11-03 56 views
1

我正在關注Web Development(cs253)www.udacity.com,並且突然開始出現錯誤:這是我第一次使用web開發。爲什麼我會通過Google App Engine的教程獲取服務器錯誤?

在Google App Engine網站上成功地遵循「hello world」教程(正如Udacity上的視頻課程所建議的)之後,我開始進行小的更改,並不斷重新提交新的修改版本,直到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分」 :-(我們對此深感抱歉!

+2

你可以分享你的代碼嗎? –

回答

2

form=後你其實只有一個"或者是隻是一個副本,因爲你應該有"""來匹配第8行的收盤報價。

+0

是的,你是正確的:雙引號丟失了:它現在有效! – chris73it

+1

在掃描一些語法錯誤的代碼之前,您可以嘗試使用像pylint或pyflakes這樣的工具來指向正確的方向,即使只是運行'python helloworld.py'也會告訴你,你有一個語法錯誤,並且vaguel在哪裏可以找到它。 – aychedee

+0

對某些工具執行的代碼進行自動預篩選將節省大量時間:非常感謝提示! – chris73it

相關問題