本文共 2243 字,大约阅读时间需要 7 分钟。
dTraceback (most recent call last):File "/home/env/lib/python3.7/site-packages/redis/connection.py", line 1199, in get_connection raise ConnectionError('Connection has data') redis.exceptions.ConnectionError: Connection has data During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/env/lib/python3.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "./web/views/account.py", line 50, in send_sms if form.is_valid(): File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 183, in is_valid return self.is_bound and not self.errors File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 175, in errors self.full_clean() File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 384, in full_clean self._clean_fields() File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 405, in _clean_fields value = getattr(self, 'clean_%s' % name)() File "./web/forms/account.py", line 148, in clean_mobile_phone conn.set(mobile_phone,code,ex=60000) File "/home/env/lib/python3.7/site-packages/redis/client.py", line 1801, in set return self.execute_command('SET', *pieces) File "/home/env/lib/python3.7/site-packages/redis/client.py", line 898, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/env/lib/python3.7/site-packages/redis/connection.py", line 1204, in get_connection raise ConnectionError('Connection not ready')
经排查错误,由于我的redis配置(我的在/etc/redis.conf)
发现并未设置 bind 0.0.0.0 如果绑定到0.0.0.0那么所有机器上的地址都可以访问服务 还有daemonize yes转载地址:http://mwxlf.baihongyu.com/