推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
029xue
V2EX  ›  Python

Debug Django using PTVS (Python Tools for Visual Studio)

  •  
  •   029xue · Apr 6, 2012 · 5395 views
    This topic created in 5288 days ago, the information mentioned may be changed or developed.
    The easiest way to debug python - especially easy for programmers get used to Visual Studio - is using PTVS (Python Tools for Visual Studio).
    The steps is simple:
    1. Download and install it from http://pytools.codeplex.com/
    2. Set breakpotints and press F5.
    3. Your breakpoint is hit, you can view/change the variables as easy as debug C#/C++ programs.
    4. That's all :)

    If you want debug Django using PTVS, you need do following steps:
    1. In Project settings - General tab, set "Startup File" to "manage.py", the entry point of Django program.
    2. In Project settings - Debug tab, set "Script Arguments" to "runserver --noreload". The key point is the "--noreload" here. If you don't set it, your breakpoints then won't be hit.
    3. Enjoy it.
    4 replies  •  1970-01-01 08:00:00 +08:00
    029xue
        1
    029xue  
    OP
       Apr 6, 2012
    dychenyi
        2
    dychenyi  
       Apr 6, 2012
    最新版确实能用了,不过导入工程时会把比如一些.svn导入进去,还不知道怎么设置过滤。我现在只能手动修改.pyproj 。
    有些地方还是没有pydev + eclipse爽。比如F3查找定位函数。出错定位代码。
    029xue
        3
    029xue  
    OP
       Apr 6, 2012
    新版本可以直接建立Python project,只会有.sln和.pyproj两个文件,还是比较简洁的。
    ayanamist
        4
    ayanamist  
       Apr 6, 2012
    我觉得目前最好的debugger依旧是pycharm的,可以支持多线程和多进程的代码调试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5015 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 63ms · UTC 07:26 · PVG 15:26 · LAX 00:26 · JFK 03:26
    ♥ Do have faith in what you're doing.