Why celery task read past value

Viewed 29

In django + celery Project,

I want celery task read value in settings.py to getattr. When I call a specific API, the value changes to setattr. But, celery still get the initial value through getattr. I tested to output the changed value when calling API, It's print change data.

def api(mode):
    setattr(settings, SYSTEM_MODE, mode)
    ...

def tasks():
    ...
    mode = getattr(settings, SYSTEM_MODE)
    ...
0 Answers
Related