V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2012-04-06 11:36:47 +08:00 · 4422 次点击
    这是一个创建于 4596 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 条回复    1970-01-01 08:00:00 +08:00
    029xue
        1
    029xue  
    OP
       2012-04-06 11:37:08 +08:00
    dychenyi
        2
    dychenyi  
       2012-04-06 14:49:47 +08:00
    最新版确实能用了,不过导入工程时会把比如一些.svn导入进去,还不知道怎么设置过滤。我现在只能手动修改.pyproj 。
    有些地方还是没有pydev + eclipse爽。比如F3查找定位函数。出错定位代码。
    029xue
        3
    029xue  
    OP
       2012-04-06 16:59:00 +08:00
    新版本可以直接建立Python project,只会有.sln和.pyproj两个文件,还是比较简洁的。
    ayanamist
        4
    ayanamist  
       2012-04-06 21:13:52 +08:00
    我觉得目前最好的debugger依旧是pycharm的,可以支持多线程和多进程的代码调试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5622 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 06:40 · PVG 14:40 · LAX 22:40 · JFK 01:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.