在运行Django时,StatReloader是什么? [英] What is StatReloader while running Django?
问题描述
我刚刚使用Django 2.2创建了新的Python 3.7 virtualenv
I've just created new Python 3.7 virtualenv with Django 2.2
它会打印每个 runserver
:
使用StatReloader监视文件更改
Watching for file changes with StatReloader
我在Django的文档等中找不到任何信息.
I could not find any info in Django's docs etc.
它是否与Django特别相关?它与Django一起使用吗?它能做什么?为什么在PyCharm中将其打印为红色?我应该注意点什么吗?可以禁用它吗?
Is it related specially to Django somehow? Does it go with Django? What it does? Why is it printed in red in PyCharm? Should I be careful about something? Could it be disabled?
大家伙
推荐答案
它是类.
具体来说,是在 get_reloader
方法,其中watchman是linux/macOS的替代方案
Specifically, determined within the get_reloader
method where watchman is an alternative for linux / macOS
如果您使用的是Linux或MacOS,并且同时安装了pywatchman和Watchman服务,则内核信号将用于自动重新加载服务器(而不是每秒轮询文件修改时间戳).这样可以在大型项目上提供更好的性能,减少代码更改后的响应时间,更强大的更改检测功能,并减少功耗.
If you’re using Linux or MacOS and install both pywatchman and the Watchman service, kernel signals will be used to autoreload the server (rather than polling file modification timestamps each second). This offers better performance on large projects, reduced response time after code changes, more robust change detection, and a reduction in power usage.
(运行服务器文档)
不知道为什么它在pycharm中显示为红色,但是如果您确实想要,可以使用-noreload
标志
No idea why its in red in pycharm but if you really wanted to you can disable it with the --noreload
flag
这篇关于在运行Django时,StatReloader是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!