Fix celery api
@@ -31,15 +31,14 @@ class CeleryTask(Task):
_logger.info("Celery task retry", extra={'task name': self.name})
+# Setup django env
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'polyaxon.settings')
+
app = Celery('polyaxon')
app.Task = CeleryTask # Custom base class for logging
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'polyaxon.settings')
-# Using a string here means the worker don't have to serialize
-# the configuration object to child processes.
app.config_from_object('django.conf:settings', namespace='CELERY')
-# Load task modules from all registered Django app configs.
app.autodiscover_tasks(lambda: [n.name for n in apps.get_app_configs()])
celery_app = app
