Django と Celery の新機能である Django Celery を初めて試してみてください。
以下は、これまでに試みたもので、次のエラーが発生します...
/contacts/upload での RuntimeError 最大再帰深度を超えました
SQS とメッセージ ブローカーを使用しています。
設定.py
# Celery
import djcelery
djcelery.setup_loader()
INSTALLED_APPS += (
'south',
'userena',
'social_auth',
'djcelery',
)
BROKER_TRANSPORT = 'sqs'
BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-west-1',
}
BROKER_USER = 'xyz'
BROKER_PASSWORD = 'zyx'
タスク.py
@task
def upload(request, **kwargs):
file = request.FILES['file']
ContactCSVModel.import_from_file(file)
return True
view.py
@login_required
def upload(request):
result = upload(request)
if result:
messages.add_message(request, messages.SUCCESS, 'Items have been added to the database.')
else:
etc
誰かが私がここで間違っていることを理解するのを手伝ってくれますか? ありがとうございました。