Django服务器不重新加载文件更改
我只是从Github克隆了一个Django项目,以在另一台计算机上进行维护,安装了所有依赖项,然后运行了服务器。除了在所有Python文件上进行文件更改时,服务器不会重新加载,一切似乎都可以正常工作。静态文件的更改也不会反映。要注意的事情:
- Django 4.0.3
- Python 3.9.0
- 环境经理是Pipenv。
settings.py
DEBUG = True
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates")],
我没有自定义runserver
命令
我对此有建议问题,但它们没有起作用。
任何帮助将不胜感激。
I just cloned a Django project from my Github for maintenance on another machine, installed all the dependencies then ran the server. Everything seems to be working fine except the fact that the server does not reload when I make file changes (on all python files). Changes in static files are not reflected too. Things to note:
- Django 4.0.3
- Python 3.9.0
- Environment manager is Pipenv.
Settings.py
DEBUG = True
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates")],
I don't have a custom runserver
command
I have the suggestions on this question but they didn't work.
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要重新加载浏览器中的所有静态文件,您需要按
ctrl + f5
(刷新高速缓存),请确保运行
python manage.py collect.pocletstatic
命令以保存所有静态单个目录中的文件,甚至使用压缩存储。对于所有Python文件,请确保在Visual Studio代码上启用
AutoSave
(我也遇到了此问题)To reload all static files in the browser you need to press
ctrl + f5
(refreshes cache)Also, make sure to run the
python manage.py collectstatic
command to save all static files in a single directory or even use compressed storage.For all python files, make sure that
autosave
is enabled on Visual Studio Code (I have faced this issue too)