From: Radek Czajka Date: Wed, 23 Apr 2014 14:04:23 +0000 (+0200) Subject: Celery 3.1, librarian update X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/ec8dcdb46798724de6c0fc0dce7fdeaafe4ebe31?ds=sidebyside Celery 3.1, librarian update --- diff --git a/apps/api/management/commands/mobileinit.py b/apps/api/management/commands/mobileinit.py index 2102bbb9c..3d88a7744 100755 --- a/apps/api/management/commands/mobileinit.py +++ b/apps/api/management/commands/mobileinit.py @@ -159,8 +159,7 @@ def add_book(db, book): def add_tag(db, tag): id = tag.id - # category = categories[tag.category] # localized names here? - category = tag.category + category = categories[tag.category] name = tag.name sort_key = tag.sort_key diff --git a/lib/librarian b/lib/librarian index ccc0df182..13b88a3bf 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit ccc0df182c479eb554148e5bbc3fd9f6bec95e20 +Subproject commit 13b88a3bfdd4fa3cf5c92368aa5cb60fa832eda6 diff --git a/requirements.txt b/requirements.txt index a2be62779..1b6930ab5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,8 +40,7 @@ lxml>=2.2.2 # MySQL-python>=1.2,<2.0 # celery tasks -django-celery>=3.0.11,<3.1 -django-kombu +django-celery>=3.1,<3.2 # spell checking pyenchant diff --git a/wolnelektury-celery.conf.template b/wolnelektury-celery.conf.template index 4d45ec70e..d36a08a8f 100644 --- a/wolnelektury-celery.conf.template +++ b/wolnelektury-celery.conf.template @@ -4,7 +4,7 @@ ; ========================================= [program:celery.%(project_name)s] -command=%(path)s/ve/bin/python %(path)s/releases/current/manage.py celeryd --loglevel=INFO +command=%(path)s/ve/bin/celery -A wolnelektury worker -l info directory=%(path)s/releases/current/ user=%(user)s numprocs=2 diff --git a/wolnelektury/__init__.py b/wolnelektury/__init__.py index e69de29bb..cf2e85f6d 100644 --- a/wolnelektury/__init__.py +++ b/wolnelektury/__init__.py @@ -0,0 +1 @@ +from .celery import app as celery_app diff --git a/wolnelektury/celery.py b/wolnelektury/celery.py new file mode 100644 index 000000000..ae5ce20ce --- /dev/null +++ b/wolnelektury/celery.py @@ -0,0 +1,21 @@ +from __future__ import absolute_import + +import os +import sys + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path = [ + os.path.join(ROOT, 'apps'), + os.path.join(ROOT, 'lib'), + os.path.join(ROOT, 'lib/librarian'), +] + sys.path + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wolnelektury.settings') + +from celery import Celery +from django.conf import settings + +app = Celery('wolnelektury') + +app.config_from_object('django.conf:settings') +app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) diff --git a/wolnelektury/settings/__init__.py b/wolnelektury/settings/__init__.py index c40bb366b..bce9bd399 100644 --- a/wolnelektury/settings/__init__.py +++ b/wolnelektury/settings/__init__.py @@ -90,7 +90,7 @@ INSTALLED_APPS_CONTRIB = [ 'south', 'sorl.thumbnail', 'djcelery', - 'djkombu', + 'kombu.transport.django', 'honeypot', #'django_nose', 'fnpdjango', diff --git a/wolnelektury/settings/celery.py b/wolnelektury/settings/celery.py index ad37707ee..e4286ce65 100644 --- a/wolnelektury/settings/celery.py +++ b/wolnelektury/settings/celery.py @@ -1,12 +1,6 @@ -import djcelery -djcelery.setup_loader() - -BROKER_BACKEND = "djkombu.transport.DatabaseTransport" -BROKER_HOST = "localhost" -BROKER_PORT = 5672 -BROKER_USER = "guest" -BROKER_PASSWORD = "guest" -BROKER_VHOST = "/" +BROKER_URL = 'django://' +CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend' CELERY_EAGER_PROPAGATES_EXCEPTIONS = True CELERY_SEND_TASK_ERROR_EMAILS = True +CELERY_ACCEPT_CONTENT = ['pickle']