ValueError: unknown URL type for redirect
ValueError: unknown URL type for redirect
$ python - <<'PY'
from urllib.parse import urlparse
print(urlparse('htp://bad'))
PY
ParseResult(scheme='htp', netloc='', path='bad', params='', query='', fragment='')
Why this happens
Invalid scheme or not using reverse() for internal paths.
Fix
Use redirect('view-name', args...) or valid absolute URLs.
Wrong code
return redirect('htp://bad')
Fixed code
from django.shortcuts import redirect
return redirect('home')