views:

58

answers:

1

i use this code can crteate ,but someone say it can't create ,why ?

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: 

App Engine does not allow you to create new threads, probably because primarily the goal of App Engine is to build simple request-response apps, and threads are usually not considered "simple".

Managing threads for an app to prevent abuse (accidental or otherwise) would be difficult, or impossible, for App Engine to do, so they just disallow them entirely.

Jason Hall
+1 Good answer !!!
Romain Hippeau