Mercurial > public > sg101
view sg101/celery.py @ 1008:bfc4a0ffe5a7
Set SSL settings to True.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 27 Nov 2015 12:58:37 -0600 |
parents | 074343986389 |
children |
line wrap: on
line source
"""Django / celery integration module.""" from __future__ import absolute_import import os import platform import sys from celery import Celery from django.conf import settings if platform.system() == 'Darwin': role = 'mac' else: 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) # Add some stuff to the Python path sys.path.append('/svr/django-sites/sg101/sg101/tools') 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))