2010-04-23 18 views
0

我使用GAE和Django的如何讓從來沒有一個線程停止,寫的東西到數據庫中的每個10秒

這是我的代碼:

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('') 
+0

要做到這一點不在App Engine上,請嘗試此鏈接! www.google.com/search?q=python+thread – 2010-04-23 14:11:12

回答

1

這是不可能的,因爲所有的請求在GAE做(包括cron工作)有30 seconds deadline

+0

如何在gae上實現這一點。 – zjm1126 2010-04-23 07:59:30

+3

這也是不可能的,因爲您無法在App Engine上啓動新線程。 – 2010-04-23 09:16:49

相關問題