Can I create threads in my application using Python?
Can this code create threads in Google App Engine. If not, why not? class LogText (db.Model): content = db.StringProperty (multiline = True)
class MyThread(threading.Thread):
def __init__(self,threadname):
threading.Thread.__init__(self, name=threadname)
def run(self,request):
log=LogText()
log.content=request.POST.get('content',None)
log.put()
def Log(request):
thr = MyThread('haha')
thr.run(request)
return HttpResponse('')
+2
a source to share
1 answer
App Engine does not allow new threads to be created, perhaps because App Engine's primary goal is to create simple request-response applications, and threads are generally not considered "simple".
Managing application threads to prevent abuse (accidental or otherwise) would be difficult or impossible for App Engine, so they just disallow them entirely.
+2
a source to share