Redirect from server to the client if no server url responds to the request

This commit is contained in:
Pawel Kowalski 2018-08-08 15:25:00 +02:00
parent 9d47f0349a
commit bac0690721
2 changed files with 2 additions and 3 deletions

View File

@ -31,5 +31,4 @@
title: 'Modules with Apollo'
}
}
</script>

View File

@ -17,8 +17,8 @@ class PrivateGraphQLView(LoginRequiredMixin, GraphQLView):
def home(request):
if settings.DEBUG:
try:
return HttpResponse(requests.get('http://localhost:8080/{}'.format(request.get_full_path())).text)
return HttpResponse(requests.get('http://localhost:3000/{}'.format(request.get_full_path())).text)
except Exception as e:
print('Can not connect to dev server at http://localhost:8080:', e)
print('Can not connect to dev server at http://localhost:3000:', e)
return render(request, 'index.html', {})