Related
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)
I created MWAA using public network option (version 2.0.2).
Created a sample of airflow dag in which start emr with next properties:
JOB_FLOW_OVERRIDES = {
'Name': 'demo-cluster-airflow',
'ReleaseLabel': 'emr-6.2.0',
'LogUri': 's3://path-to-log/',
'Applications': [
{
'Name': 'spark'
},
{
'Name': 'livy'
}
],
'Instances': {
'InstanceGroups': [
{
'Name': 'Master nodes',
'Market': 'ON_DEMAND',
'InstanceRole': 'MASTER',
'InstanceType': 'm5.xlarge',
'InstanceCount': 1,
}
],
'KeepJobFlowAliveWhenNoSteps': True,
'TerminationProtected': False,
'Ec2KeyName': 'key',
},
'VisibleToAllUsers': True,
'JobFlowRole': 'EMR_EC2_DefaultRole',
'ServiceRole': 'EMR_DefaultRole',
'Tags': [
{
'Key': 'Environment',
'Value': 'Development'
}
]
}
cluster_creator = EmrCreateJobFlowOperator(
task_id='create_cluster',
job_flow_overrides=JOB_FLOW_OVERRIDES
)
it starts ok,
then, call livy in PythonOperator with next code
def create_spark_session(master_dns, kind='spark'):
# 8998 is the port on which the Livy server runs
host = 'http://' + master_dns + ':8998'
data = {'kind': kind}
headers = {'Content-Type': 'application/json'}
logging.info(f"querying {host}/sessions")
response = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
logging.info(response.json())
return response.headers
But, task is failing with error:
[2021-06-22 18:43:19,272] {{EmrDag.py:92}} INFO - querying http://ip-10-192-21-17.us-east-2.compute.internal:8998/sessions
[2021-06-22 18:45:29,709] {{taskinstance.py:1482}} ERROR - Task failed with exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib64/python3.7/http/client.py", line 1277, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1323, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1272, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.7/http/client.py", line 1032, in _send_output
self.send(msg)
File "/usr/lib64/python3.7/http/client.py", line 972, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 172, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f19a79a6350>: Failed to establish a new connection: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 446, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='ip-10-192-21-17.us-east-2.compute.internal', port=8998): Max retries exceeded with url: /sessions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f19a79a6350>: Failed to establish a new connection: [Errno 110] Connection timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1138, in _run_raw_task
self._prepare_and_execute_task_with_callbacks(context, task)
File "/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1311, in _prepare_and_execute_task_with_callbacks
result = self._execute_task(context, task_copy)
File "/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1341, in _execute_task
result = task_copy.execute(context=context)
File "/usr/local/lib/python3.7/site-packages/airflow/operators/python.py", line 117, in execute
return_value = self.execute_callable()
File "/usr/local/lib/python3.7/site-packages/airflow/operators/python.py", line 128, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/usr/local/airflow/dags/EmrDag.py", line 164, in submit_pi
headers = create_spark_session(cluster_dns, 'spark')
File "/usr/local/airflow/dags/EmrDag.py", line 93, in create_spark_session
response = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='ip-10-192-21-17.us-east-2.compute.internal', port=8998): Max retries exceeded with url: /sessions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f19a79a6350>: Failed to establish a new connection: [Errno 110] Connection timed out'))
[2021-06-22 18:45:29,795] {{taskinstance.py:1532}} INFO - Marking task as FAILED. dag_id=EmrDag, task_id=submit_pi, execution_date=20210622T183209, start_date=20210622T184317, end_date=20210622T184529
Looks like the problem is in networking from MWAA to Livy, but can't get how to fix it...
Issue resolved setting:
Ec2SubnetId = subnetid created by MWAA
EmrManagedMasterSecurityGroup = security group created by MWAA
EmrManagedSlaveSecurityGroup = security group created by MWAA
in JOB_FLOW_OVERRIDES
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
If the website I'm trying to connect to via a proxy is unsecured (HTTP), then I'm able to connect, however if it's secured (HTTPS), then I can't.
The following code works:
import urllib2
proxy_support = urllib2.ProxyHandler({'http':'xxx.xxx.xxx.xx'})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
html = urllib2.urlopen('http://www.example.com').read()
However the code below does not work,
proxy_support = urllib2.ProxyHandler({'https':'xxx.xxx.xxx.xx'})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
html = urllib2.urlopen('https://www.example.com').read()
Instead I get the following traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
context=self._context)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 61] Connection refused>
According to https://docs.python.org/2/library/urllib2.html:
Changed in version 2.7.9: cafile, capath, cadefault, and context were added.
This one allowed me to connect to my local HTTPS site that is using a self-signed SSL certificate:
html = urllib2.urlopen('http://www.example.com'),\
context=ssl._https_verify_certificates(False)
I noticed in your traceback the similarities with mine. The code, just like you posted, works on Ubuntu 14.04 (Python 2.7.6) but not in 16.04 (Python 2.7.13) with exception to the last one:
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
context=self._context)
File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
I'm not sure if this work on your end.
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']