Django配置https协议
本博客来自https://blog.csdn.net/huplion/article/details/52892901
1.首先我们需要得到一张证书文件
参考:WINDOWS系统下创建自签名SSL证书
并复制到项目的主目录下,本文中的证书文件的名称为server.crt,下文以此为例。
2.python环境准备
确认之前已经正确安装Python3,Django1.8及以上
还需要安装的python库有:
django-extensions
django-werkzeug-debugger-runserver
pyOpenSSL
执行pip install命令安装:
pip install django-extensions
pip install django-werkzeug-debugger-runserver
pip install pyOpenSSL
3.配置settings.py
原来的settings.py
加入以下两行:
'werkzeug_debugger_runserver',
'django_extensions',
- 1
- 2
修改后的settings.py
4.开启cmd,工作目录切换到项目的主目录下
执行
python manage.py runserver_plus --cert server.crt 127.0.0.1:7000
可以看到我们已经可以已https的方式来访问了。
如果使用Pycharm开发,可以做以下配置:
Django配置https协议的更多相关文章
- 【转】Linux下nginx配置https协议访问的方法
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- 在linux下的apache配置https协议,开启ssl连接
环境:linux 配置https协议,需要2大步骤: 一.生成服务器证书 1.安装openssl软件 yum install -y openssl mod_ssl 2.生成服务器私匙,生成server ...
- tomcat配置https协议
tomcat配置https协议 1.找到本地jdk底下的bin目录,bin目录底下存在文件keytool.exe(在bin目录下空白处,按住shift右击,打开命令窗口,如下图) 2.在cmd的命令窗 ...
- Tomcat8配置Https协议,Tomcat配置Https安全访问,Tomcat Https配置
Tomcat8配置Https协议,Tomcat配置Https安全访问,Tomcat Https配置 ============================== ©Copyright 蕃薯耀 2017 ...
- Tomcat配置https协议访问
Tomcat9配置https协议访问: https://blog.csdn.net/weixin_42273374/article/details/81010203 配置Tomcat使用https协议 ...
- apache配置https协议
安装openssl有两种方式,第一种直接下载安装包,装上就可运行:第二种可以自己下载源码,自己编译.下面对两种方式均进行详细描述. 一.下载和安装openss 方法一:直接使用openssl安装包 W ...
- Linux服务之nginx服务篇四(配置https协议访问)
一.配置nginx支持https协议访问 编译安装nginx的时候需要添加相应的模块--with-http_ssl_module和--with-http_gzip_static_module(可通过/ ...
- Linux下nginx配置https协议访问
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- tomcat 配置https协议
开发的人脸识别功能,在本地localhost是可以访问,换成IP地址不能访问,通过不了浏览器的安全协议, 要把http协议,转成https协议,才能正常访问 方案有二种 1.在项目springboot ...
随机推荐
- Windows下CVSNT安装配置
首先要说明:X64下安装此软件会报 “cvs [login aborted]: WIN-4H9CRJO1TRA\Administrator: Switch to user failed due to ...
- centos systemctl daemon-reload 提示 no such file or directory 的一个原因
service 的文件名写错了 比如 mongodb.service 写成了 mongodb.srvice 真的是坑,居然没有提示具体的路径,只是提示一个 no such file or direct ...
- Error: cannot allocate vector of size 88.1 Mb问题
这几天训练模型运行代码的时候,老是提示我说:Error: cannot allocate vector of size 88.1 Mb,只知道分配空间不足. 下面是查资料看到的一些回答: 一.这个是R ...
- NO.6LINUX基本命令
1.练习1 ) 将用户信息数据库文件和组信息数据库文件纵向合并为一个文件/1.txt(覆盖) cd / cat /etc/passwd /etc/group>1.txt 2) 将用户信息数据库文 ...
- webpack 多页面|入口支持和公共组件单独打包--转载
转载自:http://www.jb51.net/article/117490.htm 本篇主要介绍:如何自动构建入口文件,并生成对应的output:公共js库如何单独打包. 多入口文件,自动扫描入口. ...
- 转:Xcode 删除文件后编译出现的missing file的警告
进入“Missing File”对应的目录进行删除即可. 1.由于使用SVN导致的,可进行如下操作: # cd ~/iHost/Demo/sfsimonutility/SFSimonUtility/S ...
- Ubuntu如何同步网络时间
解决方法: 1.安装ntpdate工具 apt-get install ntpdate 2.将系统时间与网络同步 ntpdate cn.pool.ntp.org 3.将时间写入硬件 hwclock - ...
- servlet程序使用tomcat启动报错
根据书上的需求写了一些简单的servlet代码,启动时报错: 严重: A child container failed during startjava.util.concurrent.Executi ...
- study later
二分图匹配.左偏树.替罪羊树 四边形不等式优化 http://txhwind.blog.163.com/blog/static/203524179201242021458422/ http://www ...
- UNDERSTANDING THE GAUSSIAN DISTRIBUTION
UNDERSTANDING THE GAUSSIAN DISTRIBUTION Randomness is so present in our reality that we are used to ...