from __future__ import absolute_import

import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'geotrek.settings.default')

app = Celery('geotrek')

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('geotrek.settings.celery')
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task(self):
    print('Request: {0!r}'.format(self.request))

from __future__ import absolute_import

import django
from celery import Celery

# Setup django project. DJANGO_SETTINGS_MODULE must be set by supervisor.
django.setup()

app = Celery('geotrek')

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('geotrek.settings.celery')
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task(self):
    print('Request: {0!r}'.format(self.request))

Fix Django setup in celery worker