Home Django don't redirect to a external url
Reply: 0

Django don't redirect to a external url

Giuseppe Ricci
Giuseppe Ricci Published in 2017-12-06 16:30:31Z

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

def redpagopa(request):
   if request:
       return redirect('http://www.google.com/')
       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://example.com/redpagopa the redirect works. I need when redirect is called, the browser be redirect on the specified url. There is some error in my code? I use Django v1.3, version mandatory.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31484 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO