2010-12-29 4 views
0

djangoでセロリを使用するのに問題があります。私はセロリを使ってウェブサイトを削り、20分ごとにいくつかのdjangoモデルを更新したい。djceleryを使用してウェブサイトをスクラップし、djangoモデルを作成する

私は更新クラスを持っている私のアプリディレクトリ内のタスクファイル作成:私は、コマンドラインから実行した場合、クラスは正しく私のmodeslを更新

class Update(PeriodicTask): 
    run_every=datetime.timedelta(minutes=20) 

    def run(self, **kwargs): 
     #update models 

を:

if __name__ == '__main__': 
    Update().run() 

マイセロリsetting.pyでの設定は次のようになります。

CELERY_RESULT_BACKEND = "database" 
BROKER_HOST = 'localhost' 
BROKER_PORT = 5672 
BROKER_USER = 'Broker' 
BROKER_PASSWORD = '*password*' 
BROKER_VHOST = 'broker_vhost' 

しかし、私はmanage.py celeryd -v 2を実行します接続エラーが発生する:

[2010-12-29 09:28:15,150: ERROR/MainProcess] CarrotListener: Connection Error: [Errno 111] Connection refused. Trying again in 10 seconds... 

私は何が欠けていますか?

アップデート:私はそれは私の既存のデータベースを使用していますbecuaseかなり良い見えたdjango-kombuを見つけ

。私はdjango-kombuとkombuをインストールしましたが、今はmanage.py celeryd -v 2を実行すると次のエラーが発生します。あなたはブローカーをインストールしているよう

Traceback (most recent call last): 
    File "manage.py", line 11, in <module> 
    execute_manager(settings) 
    File "<webapp_path>/lib/python2.6/django/core/management/__init__.py", line 438, in execute_manager 
    utility.execute() 
    File "<webapp_path>/lib/python2.6/django/core/management/__init__.py", line 379, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "<webapp_path>/lib/python2.6/django/core/management/base.py", line 191, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "<webapp_path>/lib/python2.6/django/core/management/base.py", line 220, in execute 
    output = self.handle(*args, **options) 
    File "<webapp_path>/lib/python2.6/django_celery-2.1.4-py2.6.egg/djcelery/management/commands/celeryd.py", line 20, in handle 
    worker.run(*args, **options) 
    File "<webapp_path>/lib/python2.6/celery-2.1.4-py2.6.egg/celery/bin/celeryd.py", line 83, in run 
    from celery.apps.worker import Worker 
    File "<webapp_path>/lib/python2.6/celery-2.1.4-py2.6.egg/celery/apps/worker.py", line 15, in <module> 
    from celery.task import discard_all 
    File "<webapp_path>/lib/python2.6/celery-2.1.4-py2.6.egg/celery/task/__init__.py", line 7, in <module> 
    from celery.execute import apply_async 
    File "<webapp_path>/lib/python2.6/celery-2.1.4-py2.6.egg/celery/execute/__init__.py", line 7, in <module> 
    from celery.result import AsyncResult, EagerResult 
    File "<webapp_path>/lib/python2.6/celery-2.1.4-py2.6.egg/celery/result.py", line 9, in <module> 
    from celery.backends import default_backend 
    File "<webapp_path>/lib/python2.6/celery-2.1.4-py2.6.egg/celery/backends/__init__.py", line 51, in <module> 
    default_backend = DefaultBackend() 
TypeError: __init__() takes exactly 2 arguments (1 given) 
+1

それはあなたがセロリの開発バージョンを必要とするあなたのペーストにセロリ-2.1.4-py2.6.eggを言いますが、昆布を使用する(2.2になるために)必要がありますが。 gitからインストールする:http://github.com/ask/celery(またはpip install -U http://github.com/ask/django-celery/tarball/master#egg=django-celery; pip install -U http ://github.com/ask/celery/tarball/master#egg=celery;その順番で)。 – asksol

答えて

1

が見えない/(RabbitMQの?)を実行している

+0

私はできるだけ少なく作業してセロリを得ようとしていました:)私は今ゲットーと仕事をしています。正しいディレクトリに私を押してくれてありがとう。 – keegan3d

+0

GhettoQも同じエラーが発生しています。ゲットーQは本当にこのゲットーですか? – Rich

0

私は同じ問題があったが、問題は、私はインポートパスが間違っていたということでした。

はおそらく、あなたは

from celery import taskとしてタスクをインポートします。

あなたは

from celery.task import task

関連する問題