使用以下代码在Google应用引擎中排队任务。但我无法排队。
html = urllib2.urlopen("http://google.com").read()
message = mail.EmailMessage(sender = "New Scrapper <temp@gmail.com>",
subject = "Sent from google app Engine")
message.to = "my_email@gmail.com"
message.body = "Thanks for visiting our website"
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.write("in home page")
class google(webapp2.RequestHandler):
def get(self):
self.response.write("In google class")
message.send()
class queue(webapp2.RequestHandler):
def get(self):
self.response.write("In queue class.")
taskqueue.add(url='/google')
self.redirect('/')
app = webapp2.WSGIApplication([('/',MainPage),('/google',google),('/queue',queue)], debug = True)