所以我目前已經安裝了芹菜3.1.8(Cipater)和Djcelery 3.1.1,但下面的教程使我的網站崩潰當前芹菜和Django的芹菜的版本似乎不兼容
因此本教程 http://docs.celeryproject.org/en/master/django/first-steps-with-django.html#django-first-steps
我幾乎跟着但是當我嘗試在settings.py
import djcelery
進口Django的芹菜此行中我得到了一個服務器錯誤。看看錯誤日誌說
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] mod_wsgi (pid=32567): Exception occurred processing WSGI script '/srv/www/site/app1/wsgi_app1.py'.
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] Traceback (most recent call last):
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi_app1.py", line 236, in __call__
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] self.load_middleware()
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] self._setup(name)
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] self._wrapped = Settings(settings_module)
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Fri Jan 24 00:47:40 2014] [error] [client 24.61.15.120] ImportError: Could not import settings 'site.settings_app1' (Is it on sys.path?): cannot import name Celery
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] mod_wsgi (pid=32567): Exception occurred processing WSGI script '/srv/www/site/app1/wsgi_app1.py'.
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] Traceback (most recent call last):
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi_app1.py", line 236, in __call__
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] self.load_middleware()
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 45, in load_middleware
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 52, in __getattr__
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] self._setup(name)
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] self._wrapped = Settings(settings_module)
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Fri Jan 24 00:47:41 2014] [error] [client 24.61.15.120] ImportError: Could not import settings 'site.settings_app1' (Is it on sys.path?): cannot import name Celery
我不知道如何繼續前進。這是進口字面上什麼導致的問題,我需要使用djcelery利用Django的後端東西
編輯:
我知道,你並不需要對大多數事情,但在發佈djcelery 3.1它說筆記 http://docs.celeryproject.org/en/master/whatsnew-3.1.html#django-supported-out-of-the-box
某些功能仍然需要Django的芹菜庫:
Celery does not implement the Django database or cache result backends.
Celery does not ship with the database-based periodic task
scheduler.
而且我想用我的DB作爲後端