卡在使用 StatReloader 监视文件更改

Stuck in Watching for file changes with StatReloader

I made my project fine and when I run my server through a normal shell it works but I am trying to run my project through git bash. All the commands seem to work fine but when I do python manage.py runserver it gets stuck on Watching for file changes with StatReloader. Apparently after that I go to localhost:8000

但是那个和我的 127 端口 8000 没有响应并且显示那里没有任何东西,没有错误或任何东西,就像我说的如果我 python manage.py runserver 到 shell 它有效

您可能缺少端口绑定,请尝试 运行 python manage.py runserver 0.0.0.0:8000 以确保该应用 运行正在 localhost:8000

上运行

可能自动重载在您的环境中不能很好地工作,如果您不需要它 - 最好通过使用 --noreload arg 启动 django 来关闭它。

如果您将 django 与 Dockerfile 一起使用,您将不会错过由 1 设置的环境变量 PYTHONUNBUFFERED。

使用 Git Bash 运行:

$ python manage.py 运行服务器 127.0.0.1:8000

在我的案例中,它表现出相同的行为 ('Stuck in watching...')。 但是,之后我打开浏览器并输入:

127.0.01:8000。 Django 网页正常运行。