我编写了一个 Django 2.2 程序,该程序在运行 Windows 10 的 PC 和运行 CentOS 7 的 VPS 中运行良好。
当我更改三个文件中的一些代码时,该应用程序继续在本地工作,但在生产中表现得很奇怪。
当我跑
python manage.py runserver 0.0.0.0:80
在我的服务器上,我得到以下响应:
***\a.py changed, reloading.
Watching for file changes with StatReloader
***\b.py changed, reloading.
Watching for file changes with StatReloader
***\c.py changed, reloading.
Watching for file changes with StatReloader
***\a.py changed, reloading.
Watching for file changes with StatReloader
***\b.py changed, reloading.
Watching for file changes with StatReloader
我在部署之前修改了这些文件,但它们不应该在站点运行时更改。
添加--noreload
标志可以防止这种情况:
python manage.py runserver --noreload 0.0.0.0:80
为什么需要这个?