Private
Public Access
1
0

improved standalone tasks

This commit is contained in:
Sander Roosendaal
2017-05-10 16:57:12 +02:00
parent e40db4c55c
commit ac2bdbce3d
3 changed files with 5 additions and 17 deletions

View File

@@ -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,

View File

@@ -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'

View File

@@ -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