我有一个django芹菜视图,它执行某些任务,并在任务完成后成功将其写入数据库。result.ready()在django芹菜中无法正常工作?
我这样做:
result = file.delay(password, source12, destination)
而且,
if result.successful() is True:
#writes into database
但是任务已完成执行后不进入,如果condition.I试图用result.ready()
但没有运气。
编辑:上述线路都在同样的观点:
def sync(request):
"""Sync the files into the server with the progress bar"""
choice = request.POST.getlist('choice_transfer')
for i in choice:
source12 = source + '/' + i
start_date1 = datetime.datetime.utcnow().replace(tzinfo=utc)
start_date = start_date1.strftime("%B %d, %Y, %H:%M%p")
basename = os.path.basename(source12) #Get file_name
extension = basename.split('.')[1] #Get the file_extension
fullname = os.path.join(destination, i) #Get the file_full_size to calculate size
result = file.delay(password, source12, destination)
if result.successful() is True:
#Write into database
E: #Writes数据库
在哪里这两条线生活在关系到彼此? – 2013-02-25 08:52:16
他们都属于同一观点。 – pynovice 2013-02-25 08:54:10