PyDev和Django:如何重启dev服务器? [英] PyDev and Django: how to restart dev server?

查看:150
本文介绍了PyDev和Django:如何重启dev服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚到Django。我想我犯了一个简单的错误。



我用Pydev启动了dev服务器:


R点击项目>> Django >>自定义
命令>> runserver


服务器出现,一切都很棒。但是现在我试图阻止它,不知道如何。我在PyDev控制台中停止了这个过程,并关闭了Eclipse,但仍然从 http://127.0 .0.1:8000 即可。



我通常从命令行启动并退出服务器:

  python manage.py runserver 

但服务器仍然在启动。我在这里做错什么?

解决方案

默认情况下,runserver命令以autoreload模式运行,该模式运行在单独的进程中。这意味着PyDev不知道如何阻止它,并且不会在控制台窗口中显示其输出。



如果您运行命令 runserver --noreload 代替,自动重新加载程序将被禁用。然后可以看到控制台输出并正常停止服务器。但是,这意味着在您手动重新启动服务器之前,您的Python文件的更改将无效。


I'm new to Django. I think I'm making a simple mistake.

I launched the dev server with Pydev:

RClick on project >> Django >> Custom command >> runserver

The server came up, and everything was great. But now I'm trying to stop it, and can't figure out how. I stopped the process in the PyDev console, and closed Eclipse, but web pages are still being served from http://127.0.0.1:8000.

I launched and quit the server from the command line normally:

python manage.py runserver

But the server is still up. What am I doing wrong here?

解决方案

By default, the runserver command runs in autoreload mode, which runs in a separate process. This means that PyDev doesn't know how to stop it, and doesn't display its output in the console window.

If you run the command runserver --noreload instead, the auto-reloader will be disabled. Then you can see the console output and stop the server normally. However, this means that changes to your Python files won't be effective until you manually restart the server.

这篇关于PyDev和Django:如何重启dev服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆