diff --git a/demos/demos/__init__.py b/demos/demos/__init__.py index 2132454..c7dac51 100644 --- a/demos/demos/__init__.py +++ b/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 diff --git a/demos/demos/settings/base.py b/demos/demos/settings/base.py index 2608368..7894f91 100755 --- a/demos/demos/settings/base.py +++ b/demos/demos/settings/base.py @@ -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