我试图使用https运行服务器,所以我安装了django-sslserver,并如下运行。
python manage.py runsslserver --certificate /etc/ssl/certs/server.crt --key /etc/ssl/private/server.key 0.0.0.0:8000
Run Code Online (Sandbox Code Playgroud)
使用以上命令成功运行。我可以通过localhost:8000或进行访问127.0.0.1:8000,但无法通过192.168.2.13:8000此处访问192.168.2.13我的IP地址。
为什么我无法通过我的IP地址访问?
并且即使使用非8000端口启动服务器,也默认为8000。在下面的示例中,我使用了8014,但是将其8000作为默认值。
root@nagapavan-HP-ProBook-440-G2:/home/nagapavan/Downloads/celestial_NAS# python manage.py runsslserver --certificate /etc/ssl/certs/server.c --key /etc/ssl/private/server.key 127.0.0.1:8014
Validating models...
System check identified some issues:
WARNINGS:
NAS.UserProfile.user: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
System check identified 1 issue (0 silenced).
October 06, …Run Code Online (Sandbox Code Playgroud)