Fix celery worker initialization by setting up Django before Celery and fixing import name
This commit is contained in:
+4
-3
@@ -1,10 +1,11 @@
|
||||
from celery import Celery
|
||||
import os
|
||||
import django
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proyecto.settings')
|
||||
django.setup()
|
||||
|
||||
app = Celery('proyecto')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proyecto.settings')
|
||||
app.config_from_object('django.conf:settings', namespace="CELERY")
|
||||
|
||||
app.user_options = {}
|
||||
|
||||
app.autodiscover_tasks()
|
||||
Reference in New Issue
Block a user