improved standalone tasks
This commit is contained in:
@@ -232,7 +232,8 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
||||
message = "Warning: This workout probably already exists in the database"
|
||||
|
||||
|
||||
w = Workout(user=r,name=title,date=workoutdate,
|
||||
|
||||
w = Workout(user=r,name=title,date=workoutdate,
|
||||
workouttype=workouttype,
|
||||
duration=duration,distance=totaldist,
|
||||
weightcategory=r.weightcategory,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
if __name__ == '__main__':
|
||||
import django
|
||||
from django.conf import settings
|
||||
django.setup()
|
||||
import os
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rowsandall_app.settings")
|
||||
|
||||
import time
|
||||
from celery import app
|
||||
@@ -13,7 +11,7 @@ from django.contrib.auth.models import User
|
||||
@app.task
|
||||
@job
|
||||
def addcomment2(userid,id):
|
||||
print 'aap'
|
||||
print 'aap met standalone'
|
||||
time.sleep(5)
|
||||
w = Workout.objects.get(id=id)
|
||||
w.notes += '\n the task has run'
|
||||
|
||||
@@ -49,17 +49,6 @@ from django_rq import job
|
||||
import time
|
||||
from async_messages import message_user,messages
|
||||
|
||||
@app.task
|
||||
@job
|
||||
def addcomment(userid,id):
|
||||
time.sleep(5)
|
||||
w = Workout.objects.get(id=id)
|
||||
w.notes += '\n the task has run'
|
||||
w.save()
|
||||
u = User.objects.get(id=userid)
|
||||
messages.info(u,' The task has run')
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
# Custom error class - to raise a NoTokenError
|
||||
|
||||
Reference in New Issue
Block a user