try with standalone
This commit is contained in:
23
rowers/tasks_standalone.py
Normal file
23
rowers/tasks_standalone.py
Normal file
@@ -0,0 +1,23 @@
|
||||
if __name__ == '__main__':
|
||||
import django
|
||||
from django.conf import settings
|
||||
django.setup()
|
||||
|
||||
import time
|
||||
from celery import app
|
||||
from django_rq import job
|
||||
from async_messages import message_user,messages
|
||||
from rowers.models import Workout
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
@app.task
|
||||
@job
|
||||
def addcomment2(userid,id):
|
||||
print 'aap'
|
||||
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
|
||||
Reference in New Issue
Block a user