我有一個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