2011-07-27 19 views
0

我想通過使用URL查詢var ['f'] ['t'] ['s'] ['c']發送一封電子郵件。 通過當我啓動在GOOGL應用程序引擎的代碼,我看到我的Python代碼在谷歌應用程序引擎有什麼問題? [發送電子郵件]

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.

我的代碼是

import cgi 
from google.appengine.api import mail 

form = cgi.FieldStorage() 

sendfrom = form.getvalue("f") 
reciver = form.getvalue("t") 
title = form.getvalue("s") 
content = form.getvalue("c") 

print sendfrom 
print reciver 
print title 
print content 


mail.send_mail(
    sender = sendfrom, 
    to = reciver, 
    subject = title, 
    body = content 
) 

我想知道什麼是錯我的代碼?

+0

是的,是的,你這樣做。 – Gleno

回答

1

在appengine.google.com上登錄到您的管理控制檯,單擊您的應用程序,然後單擊「日誌」。此頁面顯示所有請求的日誌記錄,出於安全性和可用性原因,這是記錄異常的地方 - 而不是返回給用戶的頁面。該頁面的例外日誌應該告訴你你做錯了什麼。另外,你真的不應該使用CGI--它很難正確(提示:你需要首先輸出標題),並且你會浪費你的時間來重新發明輪子,因爲很多事情更容易做一個適當的框架。改爲使用WSGI框架,like this

相關問題