Commit ac74403fe0148f26a2bc292f3b109d9f51f0c624

Authored by Etienne Pallier
1 parent 7f83556a
Exists in dev

bugfixed my wrong modifs

src/monitoring/tasks.py
... ... @@ -3,9 +3,9 @@ from django.conf import settings
3 3 from common.models import *
4 4  
5 5 # (EP) OLD task base class
6   -#from celery.task import Task
7   -# NEW task base class
8   -from celery import Task
  6 +from celery.task import Task
  7 +# NEW task base class, but DOES NOT WORK (because celery3 and not 4 ?) !!!
  8 +#from celery import Task
9 9  
10 10 from devices.PLC import PLCController
11 11 from utils.JDManipulator import *
... ...
src/pyros/celery.py
... ... @@ -19,9 +19,9 @@ app = Celery('pyros')
19 19 # the configuration object to child processes.
20 20 # - namespace='CELERY' means all celery-related configuration keys
21 21 # should have a `CELERY_` prefix.
22   -# EP modif:
23   -#app.config_from_object('django.conf:settings')
24   -app.config_from_object('django.conf:settings', namespace='CELERY')
  22 +app.config_from_object('django.conf:settings')
  23 +# Celery 4:
  24 +#app.config_from_object('django.conf:settings', namespace='CELERY')
25 25  
26 26  
27 27 ''' Load task modules from all registered Django app configs.
... ...
src/pyros/settings.py
... ... @@ -231,6 +231,8 @@ else:
231 231  
232 232 # CELERY_RESULT_BACKEND = 'rpc://'
233 233 CELERY_RESULT_BACKEND = 'amqp'
  234 +# (EP) TODO: This should also be added (according to https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html)
  235 +#CELERY_BROKER_URL = 'amqp://localhost'
234 236  
235 237 CELERY_ACCEPT_CONTENT = ['json']
236 238 CELERY_TASK_SERIALIZER = 'json'
... ...