我在另一个应用程序中对芹菜有相同的设置,当我启动另一个应用程序时,他正在工作,绝对工作,但是当我启动它时,没有什么,我安装了另外一个的everthyng,但没有,请帮助我!
如果你有一些想法如何解决,请告诉我们)
这是完全追溯
Traceback (most recent call last):
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\utils\__init__.py", line 423, in __call__
return self.__value__
AttributeError: 'ChannelPromise' object has no attribute '__value__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 449, in _ensured
return fun(*args, **kwargs)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\messaging.py", line 177, in _publish
channel = self.channel
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\messaging.py", line 194, in _get_channel
channel = self._channel = channel()
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\utils\__init__.py", line 425, in __call__
value = self.__value__ = self.__contract__()
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\messaging.py", line 209, in <lambda>
channel = ChannelPromise(lambda: connection.default_channel)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 771, in default_channel
self.connection
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 756, in connection
self._connection = self._establish_connection()
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 711, in _establish_connection
conn = self.transport.establish_connection()
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\transport\pyamqp.py", line 116, in establish_connection
conn = self.Connection(**opts)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\connection.py", line 165, in __init__
self.transport = self.Transport(host, connect_timeout, ssl)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\connection.py", line 186, in Transport
return create_transport(host, connect_timeout, ssl)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\transport.py", line 299, in create_transport
return TCPTransport(host, connect_timeout)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\transport.py", line 95, in __init__
raise socket.error(last_err)
OSError: [WinError 10061]The connection is not established, because the destination computer rejected the connection request
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\django\core\handlers\exception.py", line 41, in inner
response = get_response(request)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\django\utils\decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\src\accounts\decorators.py", line 25, in _wrapped_view
return view_func(request, *args, **kwargs)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\src\accounts\views.py", line 41, in signup
register_task.delay(username, password, email, get_secret_key)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\celery\app\task.py", line 453, in delay
return self.apply_async(args, kwargs)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\celery\app\task.py", line 559, in apply_async
**dict(self._get_exec_options(), **options)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\celery\app\base.py", line 353, in send_task
reply_to=reply_to or self.oid, **options
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\celery\app\amqp.py", line 305, in publish_task
**kwargs
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\messaging.py", line 172, in publish
routing_key, mandatory, immediate, exchange, declare)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 470, in _ensured
interval_max)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 382, in ensure_connection
interval_start, interval_step, interval_max, callback)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\utils\__init__.py", line 246, in retry_over_time
return fun(*args, **kwargs)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 250, in connect
return self.connection
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 756, in connection
self._connection = self._establish_connection()
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\connection.py", line 711, in _establish_connection
conn = self.transport.establish_connection()
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\kombu\transport\pyamqp.py", line 116, in establish_connection
conn = self.Connection(**opts)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\connection.py", line 165, in __init__
self.transport = self.Transport(host, connect_timeout, ssl)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\connection.py", line 186, in Transport
return create_transport(host, connect_timeout, ssl)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\transport.py", line 299, in create_transport
return TCPTransport(host, connect_timeout)
File "C:\Users\P.A.N.D.E.M.I.C\Desktop\shop\lib\site-packages\amqp\transport.py", line 95, in __init__
raise socket.error(last_err)
OSError: [WinError 10061] `The connection is not established, because the destination computer rejected the connection request`
这是芹菜
from __future__ import absolute_import
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'src.settings')
from django.conf import settings
from celery import Celery
app = Celery('src')
# This reads, e.g., CELERY_ACCEPT_CONTENT = ['json'] from settings.py:
app.config_from_object('django.conf:settings')
# For autodiscover_tasks to work, you must define your tasks in a file called 'tasks.py'.
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
@app.task(bind=True)
def debug_task(self):
print("Request: {0!r}".format(self.request))
这是设置
# CELERY STUFF
BROKER_URL = 'redis://127.0.0.1:6379'
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = TIME_ZONE
这是视图
@csrf_protect
@check_recaptcha
def signup(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
print(form)
if form.is_valid() and request.recaptcha_is_valid:
print(form.cleaned_data)
email = form.cleaned_data['email']
username = form.cleaned_data['username']
password = form.cleaned_data['password1']
get_secret_key = activation_key_generator(username)
link = "127.0.0.1:8000/accounts/activate/{0}".format(get_secret_key)
html_message = '<h3>Your username: <b>{0}</b> <br> <b>Your password: <b>{1}</b></h3><br><h1>That to get full access to our services, go through link below!</h1> <br> <a href="{2}">Activate</a> need raw link? <br> {2}'.format(username, password, link)
register_task.delay(username, password, email, get_secret_key)
send_some_email_task.delay(email, username, html_message)
return redirect('/accounts/register/verification')
form = RegistrationForm(request.POST or None)
context = {'form':form}
return render(request, 'accounts/registration/signup.html', context)
答案 0 :(得分:-1)
你在评论中说你正在使用Redis,但你的配置是RabbitMQ。查看Using Redis页面以获取有关配置的更多信息。更具体地说,您的代理网址应该是redis://:password@hostname:port/db_number
,而不是amqp。