Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python和google地图引擎上向线程模块发送一些数据_Python_Django_Google App Engine_Multithreading - Fatal编程技术网

如何在python和google地图引擎上向线程模块发送一些数据

如何在python和google地图引擎上向线程模块发送一些数据,python,django,google-app-engine,multithreading,Python,Django,Google App Engine,Multithreading,错误是: from google.appengine.ext import db class Log(db.Model): content = db.StringProperty(multiline=True) class MyThread(threading.Thread): def run(self,request): #logs_query = Log.all().order('-date') #logs = logs_query.fetc

错误是:

from google.appengine.ext import db
class Log(db.Model):
    content = db.StringProperty(multiline=True)

class MyThread(threading.Thread):
    def run(self,request):
        #logs_query = Log.all().order('-date')
        #logs = logs_query.fetch(3)
        log=Log()
        log.content=request.POST.get('content',None)
        log.put()

def Log(request):
    thr = MyThread()
    thr.start(request)
    return HttpResponse('')
当我不发送请求时

TypeError at /log
start() takes exactly 1 argument (2 given)
错误是:

class MyThread(threading.Thread):
    def run(self):
        log=Log()
        log.content=request.POST.get('content',None)
        log.put()
def Log(request):
    thr = MyThread()
    thr.start()

    return HttpResponse('')

我不确定这是否能满足您的需求,甚至在谷歌appengine中也不可能,但是


如果您将
thr.start(request)
更改为
thr.run(request)
错误应该消失

您不能在App Engine上使用线程。

注意:根据文档,Google不允许在其服务器中使用线程。
Exception in thread Thread-1:
Traceback (most recent call last):
  File "D:\Python25\lib\threading.py", line 486, in __bootstrap_inner
    self.run()
  File "D:\zjm_code\helloworld\views.py", line 33, in run
    log.content=request.POST.get('content',None)
NameError: global name 'request' is not defined