[英]Breakpoints not working for Django Project with python environment 2.7 in Visual Studio with PTVS
I get the following errors when I try to set a breakpoint for html files in a Django project: 尝试为Django项目中的html文件设置断点时出现以下错误:
"A breakpoint could not be inserted at this location" “无法在此位置插入断点”
"This is not a valid location for a breakpoint" “这不是断点的有效位置”
In .py files I can set breakpoints but they will not get hit. 在.py文件中,我可以设置断点,但不会被命中。
If I make a new Djnago project the breakpoints can be set in both html and .py files and they do get hit and therefore I do not think there is anything wrong with my Visual Stuido installation. 如果我创建一个新的Djnago项目,则可以在html和.py文件中设置断点,并且它们确实会命中,因此我认为Visual Stuido安装没有任何问题。
I have tried removing the projects .suo file but it does not make any difference and I have tried setting breakpoints with both the mouse pointer and F9 key. 我尝试删除项目.suo文件,但没有任何区别,并且尝试使用鼠标指针和F9键设置断点。
I'm using Visual Studio 2013 with update 4 and PTVS 2.1 (Python Tools for visual studio). 我正在将Visual Studio 2013与更新4和PTVS 2.1(用于Visual Studio的Python工具)一起使用。
Managed to fix the error myself. 设法自己修复错误。 What I had done was create a project "From Existing Python code". 我所做的是创建一个“来自现有Python代码”项目。 Instead I created a new Django Web Project in Visual Studio and then deleted all files that Visual Studio automatically added. 相反,我在Visual Studio中创建了一个新的Django Web项目,然后删除了Visual Studio自动添加的所有文件。
Then I included my old Django-files in the project and the breakpoints started working. 然后,我将旧的Django文件包含在项目中,并且断点开始工作。 Don't forget to set Django Settings Module location (settings.py) by right clicking the project, select the Django tab and edit the row "Settings Module". 不要忘记通过右键单击项目,选择Django选项卡并编辑“ Settings Module”行来设置Django设置模块的位置(settings.py)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.