简体   繁体   中英

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:

  • "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.

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.

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.

I'm using Visual Studio 2013 with update 4 and PTVS 2.1 (Python Tools for visual studio).

Managed to fix the error myself. What I had done was create a project "From Existing Python code". Instead I created a new Django Web Project in Visual Studio and then deleted all files that Visual Studio automatically added.

Then I included my old Django-files in the project and the breakpoints started working. 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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM