Mercurial > public > sg101
view sg101/celery.py @ 753:ad53d929281a
For issue #62, upgrade Haystack from 1.2.7 to 2.1.0.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 03 Jan 2014 19:01:18 -0600 |
parents | aeafbf3ecebf |
children | fa7377d90160 |
line wrap: on
line source
"""Django / celery integration module.""" from __future__ import absolute_import import os import platform from celery import Celery from django.conf import settings role = 'production' if platform.node() == 'jaguar' else 'local' settings_val = 'sg101.settings.{}'.format(role) # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', settings_val) app = Celery('sg101') app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) # It's useful to have a debug task laying around: @app.task(bind=True) def debug_task(self): print('Request: {0!r}'.format(self.request))