我正在 Windows 机器上开发基于 django 的站点,但我将更改推送到无头 Ubuntu 服务器以用于暂存目的。当我 git 将更改拉入登台服务器上的工作目录时,我需要运行 manage.py collectstatic。但是,当我这样做时,更改监视器(重新加载源代码的“监视代码更改”部分)报告它已检测到更改的文件:
monitor (pid=26216): Starting change monitor.
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: monitor (pid=26216): Change detected to 'myproject/manage.py'.
monitor (pid=26216): Triggering process restart.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/envs/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/envs/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/envs/myproject/local/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv
self.execute(*args, **options.__dict__)
File "/envs/myproject/local/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute
output = self.handle(*args, **options)
File "/envs/myproject/local/lib/python2.7/site-packages/django/core/management/base.py", line 385, in handle
return self.handle_noargs(**options)
File "/envs/myproject/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 160, in handle_noargs
% (destination_display, clear_display))
KeyboardInterrupt
我运行“touch myproject/wsgi.py”来“更新更改缓存”,然后再次运行 collectstatic 命令。这导致了同样的错误。
然后我进入 python 控制台并手动运行监视器启动命令:
import myproject.monitor
myproject.monitor.start(1)
这没什么区别。我还尝试向监视器添加一个条件,以便在检查文件更改时忽略 manage.py 但这只是给了我与 myproject/__init__.py 报告为已更改的文件相同的错误。有谁知道是什么原因造成的?