Celery 3.1, librarian update
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Wed, 23 Apr 2014 14:04:23 +0000 (16:04 +0200)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Wed, 23 Apr 2014 14:04:45 +0000 (16:04 +0200)
apps/api/management/commands/mobileinit.py
lib/librarian
requirements.txt
wolnelektury-celery.conf.template
wolnelektury/__init__.py
wolnelektury/celery.py [new file with mode: 0644]
wolnelektury/settings/__init__.py
wolnelektury/settings/celery.py

index 2102bbb..3d88a77 100755 (executable)
@@ -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
 
index ccc0df1..13b88a3 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ccc0df182c479eb554148e5bbc3fd9f6bec95e20
+Subproject commit 13b88a3bfdd4fa3cf5c92368aa5cb60fa832eda6
index a2be627..1b6930a 100644 (file)
@@ -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
index 4d45ec7..d36a08a 100644 (file)
@@ -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
index e69de29..cf2e85f 100644 (file)
@@ -0,0 +1 @@
+from .celery import app as celery_app
diff --git a/wolnelektury/celery.py b/wolnelektury/celery.py
new file mode 100644 (file)
index 0000000..ae5ce20
--- /dev/null
@@ -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)
index c40bb36..bce9bd3 100644 (file)
@@ -90,7 +90,7 @@ INSTALLED_APPS_CONTRIB = [
     'south',
     'sorl.thumbnail',
     'djcelery',
-    'djkombu',
+    'kombu.transport.django',
     'honeypot',
     #'django_nose',
     'fnpdjango',
index ad37707..e4286ce 100644 (file)
@@ -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']