【发布时间】:2020-04-11 13:32:44
【问题描述】:
我编写了一个 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
为什么需要这个?
【问题讨论】:
-
为什么这些文件首先会发生变化?
-
我正在编辑,需要新代码