From ac74403fe0148f26a2bc292f3b109d9f51f0c624 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Fri, 16 Feb 2018 16:26:44 +0100 Subject: [PATCH] bugfixed my wrong modifs --- src/monitoring/tasks.py | 6 +++--- src/pyros/celery.py | 6 +++--- src/pyros/settings.py | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/monitoring/tasks.py b/src/monitoring/tasks.py index b8da8cb..53a5128 100644 --- a/src/monitoring/tasks.py +++ b/src/monitoring/tasks.py @@ -3,9 +3,9 @@ from django.conf import settings from common.models import * # (EP) OLD task base class -#from celery.task import Task -# NEW task base class -from celery import Task +from celery.task import Task +# NEW task base class, but DOES NOT WORK (because celery3 and not 4 ?) !!! +#from celery import Task from devices.PLC import PLCController from utils.JDManipulator import * diff --git a/src/pyros/celery.py b/src/pyros/celery.py index ef196a7..f0feabb 100644 --- a/src/pyros/celery.py +++ b/src/pyros/celery.py @@ -19,9 +19,9 @@ app = Celery('pyros') # the configuration object to child processes. # - namespace='CELERY' means all celery-related configuration keys # should have a `CELERY_` prefix. -# EP modif: -#app.config_from_object('django.conf:settings') -app.config_from_object('django.conf:settings', namespace='CELERY') +app.config_from_object('django.conf:settings') +# Celery 4: +#app.config_from_object('django.conf:settings', namespace='CELERY') ''' Load task modules from all registered Django app configs. diff --git a/src/pyros/settings.py b/src/pyros/settings.py index 3435dde..3302ef3 100644 --- a/src/pyros/settings.py +++ b/src/pyros/settings.py @@ -231,6 +231,8 @@ else: # CELERY_RESULT_BACKEND = 'rpc://' CELERY_RESULT_BACKEND = 'amqp' +# (EP) TODO: This should also be added (according to https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html) +#CELERY_BROKER_URL = 'amqp://localhost' CELERY_ACCEPT_CONTENT = ['json'] CELERY_TASK_SERIALIZER = 'json' -- libgit2 0.21.2