Django Eclipse调试不断断点 [英] Django Eclipse debug. Not stopping at breakpoints

查看:197
本文介绍了Django Eclipse调试不断断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过Eclipse调试我的Django项目。当通过命令提示符启动服务器后,当我将url输入到浏览器中时,应用程序工作正常。现在我想调试它。



我已经完成了以下操作:我已经设置了一个调试/运行配置:在配置的主选项卡中,它指向项目,并views.py。在参数选项卡中,我有程序参数:runserver --noreload。 (我写调试/运行配置,因为它似乎去相同的配置,无论我做调试为还是运行为。)



我已经添加了断点到我的代码。



我很困惑我是否应该首先通过命令提示符启动服务器;所以我试过两种方式。而且我对于是否应该从Eclipse中执行Run as或Debug as而感到困惑。因此,我尝试了所有的组合:



combi 1:
通过命令提示符运行服务器。单击我的项目(或模块 - 尝试两者),然后选择运行方式/运行配置。选择我的新配置并运行。结果:控制台标题栏显示:--noreload。如果我现在在浏览器中输入url,它可以正常工作,而不是在断点处停止。



combi 2:
通过命令提示符运行服务器。单击我的项目(或模块 - 尝试两者),然后选择调试为/调试配置。选择我的新配置并运行。结果:控制台标题栏显示:views.py。在控制台中,它显示为pydev debugger:starting如果我现在在浏览器中输入url,它可以正常工作,而不是在断点处停止。



combi 3/4 :
服务器未从命令提示符运行。相同的结果与1和2,除了浏览器无法连接到本地主机。



我看到一个教程,说DJANGO_SETTINGS_MODULE设置为值设置和PYTHONPATH设置为值$ PWD。当我这样做,我得到一个错误,它找不到我的设置文件。因此,我也留下了这些,也是因为我看到另一个教程,根本没有设置。

解决方案

原来是一个愚蠢的错误:在调试配置中,我的主要模块指向views.py而不是manage.py。改变它固定问题。


I am trying to debug my Django project via Eclipse. The app works fine when I type the url into the browser after starting the server via the command prompt. Now I want to debug it.

I have done the following: I have set up a debug/run configuration: In the configuration's Main tab it points to the project and to views.py. In the arguments tab I have Program arguments: runserver --noreload. (I write debug/run configuration because it seems to go to the same configuration, whether I do "Debug as" or "Run as".)

I have added a breakpoint to my code.

I am confused about whether I should first start the server via the command prompt; I have therefore tried both ways. And I am confused about whether I should do "Run as" or "Debug as" from Eclipse. I have therefore tried all combis:

combi 1: Run server via command prompt. Click on my project (or module- tried both) and then select "Run as/Run Configuration". Select my new configuration and run. Result: the console title bar reads: --noreload. If I now type the url into the browser, it works fine, not stopping at the breakpoint.

combi 2: Run server via command prompt. Click on my project (or module- tried both) and then select "Debug as/Debug Configuration". Select my new configuration and run. Result: the console title bar reads: views.py. In the console it reads "pydev debugger: starting" If I now type the url into the browser, it works fine, not stopping at the breakpoint.

combi 3/4: Server is not running from the command prompt. Same result as 1 and 2, except that the browser cannot connect to localhost.

I read a tutorial that said to have DJANGO_SETTINGS_MODULE set to value settings and PYTHONPATH set to value $PWD. When I do this I get an error that it can't find my settings file. I therefore left these out, also because I saw another tutorial where they were not set at all.

解决方案

It turned out to be a dumb error: In debug configuration, I had Main Module pointing to views.py instead of to manage.py. Changing it fixed the problem.

这篇关于Django Eclipse调试不断断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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