Skip to content

Commit

Permalink
settings.py,__init__.py: update celery configuration
Browse files Browse the repository at this point in the history
- register 'custom-json' as kombu serializer
- set 'custom-json' as the default celery serializer
- fix the result backend configuration
- import settings from django.conf (it allows using different settings modules)
- celery 3.1.19 is NOT supported due to a bug in the redis backend (only affects UNIX-domain sockets, see: celery/celery#2903)
  • Loading branch information
mlevogiannis authored and xrg committed Feb 6, 2016
1 parent 5829deb commit 8069315
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions demos/demos/__init__.py
@@ -1,8 +1,17 @@
# File: __init__.py

from .settings import base
from django.conf import settings

if set(base.DEMOS_APPS).intersection(['ea', 'bds', 'abb']):
from .settings.celeryapp import app as celery_app

import json

from functools import partial
from kombu.serialization import register
from demos.common.utils.json import CustomJSONEncoder

register('custom-json', partial(json.dumps, cls=CustomJSONEncoder), \
json.loads, 'application/x-custom-json', 'utf-8')


#eof
3 changes: 3 additions & 0 deletions demos/demos/settings/base.py
Expand Up @@ -320,6 +320,9 @@


# End of demos-specific configuration
CELERY_TASK_SERIALIZER = 'custom-json'
CELERY_RESULT_SERIALIZER = 'custom-json'
CELERY_ACCEPT_CONTENT = ['custom-json', 'json', 'msgpack']

if DEVELOPMENT:
DEBUG = True
Expand Down

0 comments on commit 8069315

Please sign in to comment.