# coding: utf-8

# Copyright Luna Technology 2015
# Matthieu Riviere <mriviere@luna-technology.com>

from __future__ import absolute_import

import os

from celery import Celery

# Set the default Django settings module for the 'celery' program
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pype.settings')

from django.conf import settings
from celery.signals import setup_logging

@setup_logging.connect
def configure_logging(sender=None, **kwargs):
    import logging
    import logging.config
    logging.config.dictConfig(settings.LOGGING)

app = Celery('pype')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)


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

[((13, 0, 13, 64), 'os.environ.setdefault', 'os.environ.setdefault', ({(13, 22, 13, 46): '"""DJANGO_SETTINGS_MODULE"""', (13, 48, 13, 63): '"""pype.settings"""'}, {}), "('DJANGO_SETTINGS_MODULE', 'pype.settings')", False, 'import os\n'), ((24, 6, 24, 20), 'celery.Celery', 'Celery', ({(24, 13, 24, 19): '"""pype"""'}, {}), "('pype')", False, 'from celery import Celery\n'), ((22, 4, 22, 47), 'logging.config.dictConfig', 'logging.config.dictConfig', ({(22, 30, 22, 46): 'settings.LOGGING'}, {}), '(settings.LOGGING)', False, 'import logging\n')]