Skip to content

Instantly share code, notes, and snippets.

@ma1onso
Created January 14, 2016 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ma1onso/ba7204c2605f4d3325da to your computer and use it in GitHub Desktop.
Save ma1onso/ba7204c2605f4d3325da to your computer and use it in GitHub Desktop.
Example for celery.py file
# coding=utf-8
from __future__ import absolute_import
import os
from django.conf import settings
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
app = Celery('project_name')
# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment