Django重定向http-> https [英] Django redirecting http -> https
本文介绍了Django重定向http-> https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行:
python manage.py runserver localhost:44100
这会将我重定向到 https
:
» http http://localhost:44100/
HTTP/1.0 301 Moved Permanently
Content-Type: text/html; charset=utf-8
Date: Mon, 05 Mar 2018 14:09:09 GMT
Location: https://localhost:44100/
Server: WSGIServer/0.1 Python/2.7.14
X-Frame-Options: SAMEORIGIN
为什么/怎么回事?什么设置可以控制 Django
是否接受 http
/ https
?
Why / how is this happening? What setting does control whether Django
accepts http
/ https
?
推荐答案
runserver
命令仅处理http。
The runserver
command only handles http.
但是,如果您将 SECURE_SSL_REDIRECT
设置为 True
,您将从http重定向到https。
However if you have SECURE_SSL_REDIRECT
set to True
then you will be redirected from http to https.
请参阅 SSL / HTTPS 了解更多信息。
这篇关于Django重定向http-> https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文