所以我目前已经安装了芹菜3.1.8(cipater)和djcelery 3.1.1,但是遵循教程使我的网站崩溃
所以本教程http://docs.celeryproject.org/en/master/django/first-steps-with-django.html#django-first steps
我几乎都遵循,但是当我尝试在 settings.py
中使用此行导入Django-celery时import djcelery
我有一个服务器错误。查看它说
的错误日志[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后端东西
编辑:
我知道您不需要大多数事情,但是在3.1的发行说明中,它说http://docs.celeryproject.org/en/master/whatsnew-3.1.html#django-supported out-the-box
某些功能仍然需要Django-Celery库:
Celery does not implement the Django database or cache result backends.
Celery does not ship with the database-based periodic task
scheduler.
我想将我的DB用作后端
好吧,这仍然是一个问题,但我了解到您实际上根本不需要django-celery来允许db saves,所以我要考虑这个答案