brownie.exceptions.RPCRequestError: Web3 is not connected - brownie

I am trying to deploy a helloWorld.sol using brownie. I am getting below error when I tried to run brownie run scripts/deploy.py.
Terminating local RPC client... Exception in thread Thread-5:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 175, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\connection.py",
line 96, in create_connection
raise err File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\connection.py",
line 86, in create_connection
sock.connect(sa) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused
it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",
line 706, in urlopen
chunked=chunked, File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",
line 394, in _make_request
conn.request(method, url, **httplib_request_kw) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 239, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "C:\Program
Files\Python37\lib\http\client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked) File "C:\Program Files\Python37\lib\http\client.py", line 1275, in
_send_request
self.endheaders(body, encode_chunked=encode_chunked) File "C:\Program Files\Python37\lib\http\client.py", line 1224, in
endheaders
self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Program Files\Python37\lib\http\client.py", line 1016, in
_send_output
self.send(msg) File "C:\Program Files\Python37\lib\http\client.py", line 956, in send
self.connect() File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 205, in connect
conn = self._new_conn() File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",
line 187, in _new_conn
self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError:
<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>:
Failed to establish a new connection: [WinError 10061] No connection
could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py",
line 449, in send
timeout=timeout File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",
line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\retry.py",
line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1',
port=8545): Max retries exceeded with url: / (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x0000021DAA2A0F28>: Failed to establish a new connection: [WinError
10061] No connection could be made because the target machine actively
refused it'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py",
line 82, in _request
response = web3.provider.make_request(method, args) # type: ignore File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\web3\providers\rpc.py",
line 91, in make_request
**self.get_request_kwargs() File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\web3_utils\request.py",
line 48, in make_post_request
response = session.post(endpoint_uri, data=data, *args, **kwargs) # type: ignore File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py",
line 590, in post
return self.request('POST', url, data=data, json=json, **kwargs) File
"C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py",
line 542, in request
resp = self.send(prep, **send_kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py",
line 655, in send
r = adapter.send(request, **kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py",
line 516, in send
raise ConnectionError(e, request=request) requests.exceptions.ConnectionError:
HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded
with url: / (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x0000021DAA2A0F28>: Failed to establish a new connection: [WinError
10061] No connection could be made because the target machine
actively refused it'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program
Files\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run() File "C:\Program Files\Python37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\state.py",
line 332, in add_to_undo_buffer
self.sleep(0) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\state.py",
line 375, in sleep
self.time_offset = int(rpc.Rpc().sleep(seconds)) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc_init.py",
line 45, in wrapped
return fn(*args, **kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc_init.py",
line 166, in sleep
return self.backend.sleep(seconds) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py",
line 91, in sleep
return _request("evm_increaseTime", [seconds]) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py",
line 86, in _request
raise RPCRequestError("Web3 is not connected.") brownie.exceptions.RPCRequestError: Web3 is not connected.
My deploy.py code is below.
from brownie import accounts, HelloWorld
def deployHelloWorld():
account = accounts[0]
helloWorldObject = HelloWorld.deploy({"from": account})
helloWorldObject.setName("Michael", {"from": account})
greeting = helloWorldObject.sayHello()
print(greeting)
def main():
deployHelloWorld()
could you please help?

This error is caused because there is no waiting after transaction. By using transaction.wait(1), as below, the problem is fixed.
transaction = helloWorldObject.setName("Michael", {"from": account})
transaction.wait(1)
greeting = helloWorldObject.sayHello()
print(greeting)

RPC is sometimes killed too quick, resulting in brownie.exceptions.RPCRequestError: Web3 is not connected.
Therefore you have to add the time.sleep(1) after every transaction to ensure your code runs smoothly.

You need to put after transactions
transactionVariable.wait(1)
time.sleep(1)

Related

testdriven.io: The Definitive Guide to Celery and Django. Running task from Django shell causes error

I am currently going through 'The Definitive Guide to Celery and Django' course by testdriven.io. I've managed to containerize the whole application. Everything was built correctly and seemed to work just fine, but when I tried to enter the Django shell and run a task, to ensure everything works correctly, the following error appeared.
>>> divide.delay(1, 2)
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/kombu/utils/functional.py", line 30, 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 "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 446, in _reraise_as_library_errors
yield
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 433, in _ensure_connection
return retry_over_time(
File "/usr/local/lib/python3.10/site-packages/kombu/utils/functional.py", line 312, in retry_over_time
return fun(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 877, in _connection_factory
self._connection = self._establish_connection()
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 812, in _establish_connection
conn = self.transport.establish_connection()
File "/usr/local/lib/python3.10/site-packages/kombu/transport/pyamqp.py", line 201, in establish_connection
conn.connect()
File "/usr/local/lib/python3.10/site-packages/amqp/connection.py", line 323, in connect
self.transport.connect()
File "/usr/local/lib/python3.10/site-packages/amqp/transport.py", line 129, in connect
self._connect(self.host, self.port, self.connect_timeout)
File "/usr/local/lib/python3.10/site-packages/amqp/transport.py", line 184, in _connect
self.sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/celery/app/task.py", line 425, in delay
return self.apply_async(args, kwargs)
File "/usr/local/lib/python3.10/site-packages/celery/app/task.py", line 575, in apply_async
return app.send_task(
File "/usr/local/lib/python3.10/site-packages/celery/app/base.py", line 788, in send_task
amqp.send_task_message(P, name, message, **options)
File "/usr/local/lib/python3.10/site-packages/celery/app/amqp.py", line 510, in send_task_message
ret = producer.publish(
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 177, in publish
return _publish(
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 523, in _ensured
return fun(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 186, in _publish
channel = self.channel
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 209, in _get_channel
channel = self._channel = channel()
File "/usr/local/lib/python3.10/site-packages/kombu/utils/functional.py", line 32, in __call__
value = self.__value__ = self.__contract__()
File "/usr/local/lib/python3.10/site-packages/kombu/messaging.py", line 225, in <lambda>
channel = ChannelPromise(lambda: connection.default_channel)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 895, in default_channel
self._ensure_connection(**conn_opts)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 432, in _ensure_connection
with ctx():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/kombu/connection.py", line 450, in _reraise_as_library_errors
raise ConnectionError(str(exc)) from exc
kombu.exceptions.OperationalError: [Errno 111] Connection refused
I've done a quick research and in most cases it seemed to be a lack of the following lines
from config.celery import app as celery_app
__all__ = ['celery_app']
in the config.__init__.py, but it's clearly not an issue here.
I also double checked whether redis container is up and listening on port 6379.
The only difference between my code and the course code is that I decided to use Poetry package manager instead of requirements.txt file and pip.
At this point I am a little bit confused I'll be thankful for any tip. You can find the whole code below:
https://github.com/Kibraks/django-celery-app

Failed to establish a new connection: [Errno 110] Connection timed out

I am trying to query the Neptune data-processing awscurl API from the EC2 instance mentioned in this link. While querying this I am getting the following:
Traceback (most recent call last):
File "/home/ec2-user/.local/bin/awscurl", line 8, in <module>
sys.exit(main())
File "/home/ec2-user/.local/lib/python3.7/site-packages/awscurl/awscurl.py", line 521, in main
inner_main(sys.argv[1:])
File "/home/ec2-user/.local/lib/python3.7/site-packages/awscurl/awscurl.py", line 509, in inner_main
allow_redirects=args.location)
File "/home/ec2-user/.local/lib/python3.7/site-packages/awscurl/awscurl.py", line 142, in make_request
return __send_request(uri, data.encode('utf-8'), headers, method, verify, allow_redirects)
File "/home/ec2-user/.local/lib/python3.7/site-packages/awscurl/awscurl.py", line 348, in __send_request
response = requests.request(method, uri, headers=headers, data=data, verify=verify, allow_redirects=allow_redirects)
File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/home/ec2-user/.local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='neptunedbcluster-abc.cluster-xyz.us-east-2.neptune.amazonaws.com', port=443): Max retries exceeded with url: /ml/dataprocessing (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f4aa7de2710>: Failed to establish a new connection: [Errno 110] Connection timed out'))

Cannot upload file via django form running apache/linux

I could use some help deciphering the following traceback and resolving specifically on a linux machine running apache and django with DEBUG = False
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 189, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 218, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 256, in handle_uncaught_exception
'request': request
File "/usr/lib/python2.7/logging/__init__.py", line 1200, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python2.7/logging/__init__.py", line 1293, in _log
self.handle(record)
File "/usr/lib/python2.7/logging/__init__.py", line 1303, in handle
self.callHandlers(record)
File "/usr/lib/python2.7/logging/__init__.py", line 1343, in callHandlers
hdlr.handle(record)
File "/usr/lib/python2.7/logging/__init__.py", line 766, in handle
self.emit(record)
File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 129, in emit
self.send_mail(subject, message, fail_silently=True, html_message=html_message)
File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 132, in send_mail
mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", line 98, in mail_admins
mail.send(fail_silently=fail_silently)
...
error: [Errno 111] Connection refused
It is unclear to me why send_mail(..., fail_silently=True, ...) should fail if fail_silently=True
How do I debug this error if it only manifests when DEBUG = False?

Django Oscar doesn't see products

I was added a new category, then I was added product type, then I was added a product. *screenshoot
I can see my new category, but there is no products at all *screenshoot
But, I can view it on my site follow link localhost:8080/catalogue/zelenaia-kraska_6/ .
I can get this link from dashboard (product -> actions -> view on site)
How to fix this problem?
CONSOLE:
Failed to query Solr using '*:*': Failed to connect to server at 'http://127.0.0.1:8983/solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=1', are you sure that URL is correct? Checking it in a browser might help: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=1 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f113b00>: Failed to establish a new connection: [Errno 111] Connection refused',))
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.4/http/client.py", line 1090, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 859, in send
self.connect()
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f113b00>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py", line 376, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=1 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f113b00>: Failed to establish a new connection: [Errno 111] Connection refused',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 366, in _send_request
timeout=self.timeout)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=1 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f113b00>: Failed to establish a new connection: [Errno 111] Connection refused',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/haystack/backends/solr_backend.py", line 134, in search
raw_results = self.conn.search(query_string, **search_kwargs)
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 720, in search
response = self._select(params, handler=search_handler)
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 418, in _select
return self._send_request('get', path)
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 375, in _send_request
raise SolrError(error_message % params)
pysolr.SolrError: Failed to connect to server at 'http://127.0.0.1:8983/solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=1', are you sure that URL is correct? Checking it in a browser might help: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=1 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f113b00>: Failed to establish a new connection: [Errno 111] Connection refused',))
Failed to query Solr using '*:*': Failed to connect to server at 'http://127.0.0.1:8983/solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=0', are you sure that URL is correct? Checking it in a browser might help: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=0 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f1305c0>: Failed to establish a new connection: [Errno 111] Connection refused',))
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.4/http/client.py", line 1090, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 859, in send
self.connect()
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f1305c0>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py", line 376, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=0 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f1305c0>: Failed to establish a new connection: [Errno 111] Connection refused',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 366, in _send_request
timeout=self.timeout)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=0 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f1305c0>: Failed to establish a new connection: [Errno 111] Connection refused',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/haystack/backends/solr_backend.py", line 134, in search
raw_results = self.conn.search(query_string, **search_kwargs)
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 720, in search
response = self._select(params, handler=search_handler)
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 418, in _select
return self._send_request('get', path)
File "/usr/local/lib/python3.4/dist-packages/pysolr.py", line 375, in _send_request
raise SolrError(error_message % params)
pysolr.SolrError: Failed to connect to server at 'http://127.0.0.1:8983/solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=0', are you sure that URL is correct? Checking it in a browser might help: HTTPConnectionPool(host='127.0.0.1', port=8983): Max retries exceeded with url: /solr/select/?wt=json&fq=category_exact%3A%28%22%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%BE%D0%B5%22%29&fq=django_ct%3A%28catalogue.product%29&facet.query=price_exact%3A%5B0+TO+20%5D&facet.query=price_exact%3A%5B20+TO+40%5D&facet.query=price_exact%3A%5B40+TO+60%5D&facet.query=price_exact%3A%5B60+TO+%2A%5D&facet=on&facet.field=rating_exact&facet.field=product_class_exact&spellcheck.collate=true&start=0&spellcheck.count=1&spellcheck=true&fl=%2A+score&q=%2A%3A%2A&rows=0 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff32f1305c0>: Failed to establish a new connection: [Errno 111] Connection refused',))
/usr/lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango110Warning: django.core.context_processors is deprecated in favor of django.template.context_processors.
return f(*args, **kwds)
[11/Mar/2017 20:25:33] "GET /catalogue/category/glavnoe_2/ HTTP/1.1" 200 25858
Not Found: /media/cache/17/d5/17d59725435216b0e455fcb9659a84f3.jpg
Internal Server Error: /media/cache/17/d5/17d59725435216b0e455fcb9659a84f3.jpg
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/django/contrib/sites/models.py", line 44, in _get_site_by_request
SITE_CACHE[host] = self.get(domain__iexact=host)
File "/usr/local/lib/python3.4/dist-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", line 387, in get
self.model._meta.object_name
django.contrib.sites.models.DoesNotExist: Site matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 235, in get_response
response = middleware_method(request, response)
File "/usr/local/lib/python3.4/dist-packages/django/contrib/flatpages/middleware.py", line 11, in process_response
return flatpage(request, request.path_info)
File "/usr/local/lib/python3.4/dist-packages/django/contrib/flatpages/views.py", line 35, in flatpage
site_id = get_current_site(request).id
File "/usr/local/lib/python3.4/dist-packages/django/contrib/sites/shortcuts.py", line 15, in get_current_site
return Site.objects.get_current(request)
File "/usr/local/lib/python3.4/dist-packages/django/contrib/sites/models.py", line 67, in get_current
return self._get_site_by_request(request)
File "/usr/local/lib/python3.4/dist-packages/django/contrib/sites/models.py", line 52, in _get_site_by_request
SITE_CACHE[domain] = self.get(domain__iexact=domain)
File "/usr/local/lib/python3.4/dist-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", line 387, in get
self.model._meta.object_name
django.contrib.sites.models.DoesNotExist: Site matching query does not exist.
[11/Mar/2017 20:25:33] "GET /media/cache/17/d5/17d59725435216b0e455fcb9659a84f3.jpg HTTP/1.1" 500 128371
[11/Mar/2017 20:25:33] "GET /static/oscar/favicon.ico HTTP/1.1" 200 1150
Make sure django.contrib.sites is in your INSTALLED_APPS list. Also make sure the SITE_ID settings is populated with an id.
SITE_ID = 1

Django error: [Errno 60] Operation timed out

I know the title is a little ambiguous and I'd only ever ask here if it wasn't a last resort - but I am stuck. I've pulled down a Django project from my work repo that is rather ancient (we're talking 1.13), and I've been tasked with bringing it into 1.9. Okay, fair enough.
I've loaded the database from a MySQL dump and faked the migrations just fine. However, when I run the server, I get hit with this:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 256, in __init__
(code, msg) = self.connect(host, port)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection
raise err
error: [Errno 60] Operation timed out
At first, I had no idea what was going on here, but from the look of it, SMTP is throwing this exception - probably due to the mailing server not being accessible. Any how, I can't even get print statements to show up in settings.py, and so have no idea where to even start to trace this problem through.
Any guidance would be lovely.
EDIT: Here is the new error:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 177, in __call__
response = self.get_response(request)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/handlers/base.py", line 230, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/handlers/base.py", line 284, in handle_uncaught_exception
'request': request
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1191, in error
self._log(ERROR, msg, args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1284, in _log
self.handle(record)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1294, in handle
self.callHandlers(record)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1334, in callHandlers
hdlr.handle(record)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 757, in handle
self.emit(record)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/utils/log.py", line 117, in emit
self.send_mail(subject, message, fail_silently=True, html_message=html_message)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/utils/log.py", line 120, in send_mail
mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/mail/__init__.py", line 97, in mail_admins
mail.send(fail_silently=fail_silently)
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/mail/message.py", line 292, in send
return self.get_connection(fail_silently).send_messages([self])
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 100, in send_messages
new_conn_created = self.open()
File "/Users/krisvukasinovic/.virtualenvs/give2gether/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 58, in open
self.connection = connection_class(self.host, self.port, **connection_params)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 256, in __init__
(code, msg) = self.connect(host, port)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection
raise err
error: [Errno 61] Connection refused
As you know, the error you were getting is because your logger was set up to send emails whenever you received an error. The problem being that your development environment doesn't have access to the mail server that this logger relies on.
What happens is django then raises this new error and the actual error gets hidden away.
The actual solution to this is to create a separate settings.py file for development, that way you don't need to worry about the mail server not being there, nor (I expect) would you really care.
When running runserver you can then specify this settings file with
runserver --settings=mysettings
For completeness, heres a very simple development settings.py file
from myapp.settings import *
print 'DEV'
DEBUG = True
# INSTALLED_APPS += ['debug_toolbar']
# MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware']