我想在在Heroku上一個Django項目運行與IronMQ芹菜和緩存,但我收到如下:芹菜,Django的,Heroku的 - 導入錯誤:沒有模塊名爲任務
2013-04-14T22:29:17.479887+00:00 app[celeryd.1]: ImportError: No module named tasks
我在做什麼錯誤?以下是我的相關代碼和djcelery和我的應用程序都在安裝的應用程序:
要求(兔AMQP是在那裏,因爲我試過IronMQ前):
Django==1.5.1
amqp==1.0.11
anyjson==0.3.3
billiard==2.7.3.27
boto==2.8.0
celery==3.0.18
dj-database-url==0.2.1
django-celery==3.0.17
django-storages==1.1.8
gunicorn==0.17.2
iron-cache==0.2.0
iron-celery==0.3.1
iron-core==1.0.2
iron-mq==0.4
iso8601==0.1.4
kombu==2.5.10
psycopg2==2.4.6
python-dateutil==2.1
pytz==2013b
requests==1.2.0
six==1.3.0
wsgiref==0.1.2
PROCFILE:
web: gunicorn myapp.wsgi
celeryd: celery -A tasks worker --loglevel=info -E
設置:
BROKER_URL = 'ironmq://'
CELERY_RESULT_BACKEND = 'ironcache://'
import djcelery
import iron_celery
djcelery.setup_loader()
任務:
from celery import task
@task()
def batchAdd(result_length, result_amount):
瀏覽次數:
from app import tasks
r = batchAdd.delay(result_length, result_amount)
return HttpResponse(r.task_id)
也嘗試(在視圖中):
from tasks import batchAdd
r = batchAdd.delay(result_length, result_amount)
return HttpResponse(r.task_id)
,並試圖這個問題,以及(在視圖中):
from app.tasks import batchAdd
r = batchAdd.delay(result_length, result_amount)
return HttpResponse(r.task_id)
而且,這裏是我的結構:
projectname
--app
----__init__.py
----__init__.pyc
----admin.py
----admin.pyc
----forms.py
----forms.pyc
----models.py
----models.pyc
----tasks.py
----tests.py
----views.py
----views.pyc
--manage.py
--Procfile
--projectname
----__init__.py
----__init__.pyc
----settings.py
----settings.pyc
----static
----templates
----urls.py
----urls.pyc
----wsgi.py
----wsgi.pyc
--requirements.txt
'就是它打破。我們能否看到你的應用程序的整個結構? –
當然可以。添加它。 – user2270029