简体   繁体   English

断点不适用于带有PTVS的Visual Studio中的python环境2.7的Django Project

[英]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.

相关问题 带有Python 3.5的PTVS 2.1不适用于Visual Studio 2010 - PTVS 2.1 with Python 3.5 not working with Visual Studio 2010 适用于Visual Studio和单元测试(PTVS)的Python工具 - Python Tools for Visual Studio and Unit Tests (PTVS) 安装适用于Visual Studio 2012(PTVS)的Python工具 - Installing Python Tools for Visual Studio 2012 (PTVS) Visual Studio 2017 Python 环境不工作 - Visual Studio 2017 Python Environment not working 在Visual Studio 2013(PTVS)中编辑自动完成设置 - Editing autocomplete settings in Visual Studio 2013 (PTVS) PTVS-Python环境名称版本不匹配 - PTVS - Python environment name version mismatch 如何使用适用于Visual Studio的Python工具(PTVS)调试在本地lighttpd服务器上运行的Python - How to debug Python running on a local lighttpd server using Python Tools for Visual Studio (PTVS) 在Visual Studio(PTVS)的Python工具中调试python代码时,如何禁止控制台窗口? - How do I suppress the console window when debugging python code in Python Tools for Visual Studio (PTVS)? 在Visual Studio中使用PTVS调试Python代码时出现控制台窗口 - Console Window Appears while debugging Python code using PTVS in Visual Studio 在编写Visual Studio + PTVS时,是否可以使用基于远程vagrant的python解释器 - Is it possible to use remote vagrant based python interpreter when coding Visual Studio + PTVS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM