Hi I'm trying to get REST request from a certain URL and if I input the url directly in the browser it works ok and output is as show in the image below
If I also try to query the url via native python on the same server where my django app is and it works fine too.
The problem is when i put the request in view.py in my django project I get a connection error as the the title of this question.
import requests
def my_method(request):
response = requests.get('http://10.150.20.103:8000/se/se-seid')
special_events_dashboard_events = response.json()
for event in special_events_dashboard_events['events']:
context['special_events'].append(event)
return render(request, 'updates/updates_network.html', context)
When I check the page in the browser, I get this error.
The REST API url is of different IP Address from my django application.
Is this a setting problem in my django application? How to work around this? I have been searching in the internet but I cant seem to find an answer to this.
question from:
https://stackoverflow.com/questions/65840232/httpconnectionpool-max-retries-exceeded-caused-by-newconnectionerror-failed-to 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…