what's wrong with my python code in google app engine? [send an email]
I want to send an email by using the URL quer开发者_JAVA技巧y var ['f'] ['t'] ['s'] ['c']. By when i launch the code in googl app engine, i see
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.
my code is
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
)
i want to know what's wrong with my code?
Log in to your admin console at appengine.google.com, click on your app, and click on 'logs'. This page shows log records for all your requests, and this is where exceptions are logged - not to the page returned to the user, for security and usability reasons. The exception log on that page ought to tell you what you're doing wrong.
Also, you really shouldn't be using CGI - it's difficult to get right (hint: you need to output headers first), and you'll waste your time reinventing the wheel for a lot of things that are much easier to do with a proper framework. Use a WSGI framework instead, like this.
精彩评论