Python Forum
Django don't redirect to an external url
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django don't redirect to an external url
#1
Hi guys,

I have this view where I execute a redirect to an external site:

def redpagopa(request):
   if request:
       return redirect('http://www.google.com/')
   else:
       return render_to_response('404.html')
....

call=redpagopa(urlpa) # call of the redirect function, redirect doesn't work
where urlpa is the url passed to the function redpagopa..in this code I explicited the address for example google. But the redirect doens't work. If I create an url entry in urls.py:

url(r'^redpagopa/$', 'mopa.views.redpagopa', name='redpagopa')
and in the browser I give the address: http://mysite.com/redpagopa the redirect works. I need when redirect is called, the browser be redirect on the specified url.
More information: I query a SOAP service and the response of this service is an url. So I need to redirect the browser on this url. I call with the instruction call=redpagopa(urlpa) the function to redirect Django (and the browser??) to the passed url.
There is some error in my code? I use Django v1.3.
Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Api request redirect url pietervp 1 1,707 Jul-28-2022, 03:05 PM
Last Post: snippsat
  Redirect uri mismatch github in django SubratP 0 1,606 Oct-04-2021, 05:04 PM
Last Post: SubratP
  redirect to page rwahdan 1 1,749 Aug-16-2021, 10:05 AM
Last Post: Larz60+
  Redirect in Python vj78 5 3,673 Apr-03-2021, 10:47 AM
Last Post: snippsat
  Redirect Url calancathy 2 3,231 Jan-13-2020, 11:54 AM
Last Post: calancathy
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,245 Jun-30-2019, 12:21 AM
Last Post: scidam
  Flask redirect(request.url) returns None iFunKtion 1 10,418 Nov-27-2018, 10:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020