Yeah, return redirect('http://stackoverflow.com/') is the correct method.
If you do the following, you can confirm that is a working method to redirect.
from django.shortcuts import redirect
def optout(request):
return redirect("http://stackoverflow.com/")
Your conditional statements must not be catching.