首页 > 解决方案 > 默认的 django 开发服务器是安全的还是其他人可以访问它?

问题描述

我是 django/python 的新手,想确保如果我从我的工作机器上自己学习 django,当 django 设置其自动开发服务器时,它不会是某种安全漏洞。我正在使用本教程:https ://docs.djangoproject.com/en/2.1/intro/tutorial01/

他们让您将开发服务器设置为:

$ python manage.py runserver

输出:

Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

November 17, 2018 - 15:50:53
Django version 2.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

其他人是否可以通过网络或仅通过 Internet 访问此服务器?怎么去检查呢?

标签: pythondjangosecurityserver

解决方案


将开发服务器托管在localhost(相当于127.0.0.1)上不会使您面临系统中可能已经存在的任何风险。您必须非常刻意地努力使外部连接可以访问它。

如果您希望在本地网络上访问该站点,您可以在0.0.0.0. 最重要的是,您必须要么已经以某种方式受到损害,要么已经做出了刻意的努力,才能通过运行开发服务器而暴露更多信息。只是在投入生产时不要使用它。


推荐阅读