python - 为什么我可以在 Debug模式下在同一个 IP 地址和端口上运行多个 django 应用程序?

标签 python django visual-studio-code

我有个问题。
当我运行 django 应用程序时,他在 localhost:8000 中运行它。
但是,如果我重新运行该应用程序,它会在 localhost:8000 中重新运行它。
由于具有该端口 (8000) 的服务器 (localhost) 已经很忙,所以它不应该出错吗?
编辑1:
当我说“重新运行应用程序”时,我的意思是这个。
我首先从 vscode 终端然后在 windows 终端上执行了“python manage.py runserver”命令。
enter image description here
编辑2:
它仅适用于第二个开发服务器。
enter image description here

最佳答案

如果您在同一端口上运行第二个 Django 开发服务器,则会出现错误。

Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Error: That port is already in use.
Terminal output showing the error
但是,当您说重新运行应用程序时,是否意味着您在再次启动之前先关闭了正在运行的开发服务器?在这种情况下,这当然不是问题。

关于python - 为什么我可以在 Debug模式下在同一个 IP 地址和端口上运行多个 django 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64833339/

相关文章:

powershell - 防止集成终端自动打开

Python 调用 boost .so 文件库未加载错误

python - Kerasplot_model()函数: More elaborate output

node.js - 如何将 Ejabberd 或 MongooseIM 与 Node.js(或 Django)连接

django - 在 Django 模板中生成 JSON 的陷阱

visual-studio-code - 在 Visual Studio Code : How can I exclude files from Quick Open but no from the explorer

visual-studio-code - Visual Studio Code 插件(格式/拼写检查)

python - 毫秒级精确 python 计时器

python - pyspark 数据框中所有列的总计数为零

javascript - 如何使用 javascript 来验证表单?