[Update] 修改一些bug

This commit is contained in:
ibuler
2019-03-22 15:18:47 +08:00
parent 311538dcf8
commit c82044f6bc
4 changed files with 17 additions and 7 deletions

View File

@@ -6,12 +6,15 @@ from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jumpserver.settings')
from django.conf import settings
from jumpserver import settings
# from django.conf import settings
app = Celery('jumpserver')
configs = {k: v for k, v in settings.__dict__.items() if k.startswith('CELERY')}
# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings', namespace='CELERY')
# app.config_from_object('django.conf:settings', namespace='CELERY')
app.namespace = 'CELERY'
app.conf.update(configs)
app.autodiscover_tasks(lambda: [app_config.split('.')[0] for app_config in settings.INSTALLED_APPS])