2016-10-21 7 views

答えて

4

が動作するはずです、return redirect("https://google.com/")試してみてください...

編集: 私はこれがなぜ起こるかを把握するためにいくつかの時間を費やしています。私はまだ分かりませんが、redirectHttpResponseRedirectへの呼び出しの結果は、resolve_url()への呼び出しから引き継ぎます。私はそれを両方とも呼び出そうとしました: resolve_url("https://google.com/")resolve_url("www.google.com")、ともに出力URL文字列"https://google.com/""www.google.com"です。次に、このURLはurlparse(force_text(url))に渡され、allowed_schemes = ['http', 'https', 'ftp']と比較されます。

for https://google.com/: 
ParseResult(scheme='https', netloc='google.com', path='/', params='', query='', fragment='') 

for www.google.com: 
ParseResult(scheme='', netloc='', path='www.google.com', params='', query='', fragment='') 

はそれが役に立てば幸い:私はここに出力され、 urlparseに両方のURLを取得しようとしました!

関連する問題