Tag: queue

  • Django with Celery

    Erste Schritte mit Celery und Django-Celery

    Installation:

    In debian wheezy, einfach folgende Pakete installieren:

    python-celery
    python-django-celery

    settings.py:

    INSTALLED_APPS = (
      ...,
      'djcelery',
      'kombu.transport.django',
      ...,
    )
    import djcelery
    djcelery.setup_loader()
    BROKER_URL="django://"

    PROJECT/APP/tasks.py:

    from celery.task import Task
    from celery.registry import tasks
    
    class SomeTask(Task):
      def run(self, SomeArg, **kwargs):
        return SomeResult
    
    tasks.register(SomeTask)

    celeryd:

    ./manage.py celeryd

    Allerdings produziert settings.DEBUG folgende Warning:

    UserWarning: Using settings.DEBUG leads to a memory leak, never use
    this setting in production environments!

    See also: