4 ms·
For my Django projects the development server is werkzeug [1] and anywhere a break point is needed I'll add 1/0 in the code then hit refresh in the browser whic
by scwoodal 7y ago
For my Django projects the development server is werkzeug [1] and anywhere a break point is needed I'll add 1/0 in the code then hit refresh in the browser which pulls up an interactive debugger [2].
[1] https://django-extensions.readthedocs.io/en/latest/runserver_plus.html https://django-extensions.readthedocs.io/en/latest/runserver...
[2] https://werkzeug.palletsprojects.com/en/0.15.x/debug/#using-the-debugger https://werkzeug.palletsprojects.com/en/0.15.x/debug/#using-...
- iamgopal 7y agoThis is what I'm going to try to use in every language from now on.
- Xavdidtheshadow 7y agoExcept for JS, which will execute `1/0` happily and without complaint. For that, I usually do `undefined.foo`.
- TazeTSchnitzel 7y agoJS has a debugger keyword!
- CaptainMarvel 7y agoPython has one too now!
- someguy1010 7y agothanks for showing me this! I use the more I learn about django-extensions the more impressed I am with its features. Being able to interact with the django shell with a jupyter notebook is awesome too.
- vraivroo 7y agoThis works in recent versions of Rails as well.
- asplake 7y agoWorks for Flask too, same dev server
- marcell 7y agoFYI you can do import pdb; pdb.set_trace() It pulls up console debugger and is a standard python package.
- scwoodal 7y agoThe visual of the entire traceback in the browser and the ability to drop into an interactive shell within a specific frame is (for me) a way better experience than pdb.
- AtHeartEngineer 7y agoWith python 3.7 you can just do 'breakpoint()' now, and it'll import pdb and run settrace. It also allows you to use other debuggers, pretty cool.
- int_19h 7y agoI wonder if they support breakpoint() ? https://docs.python.org/3/library/functions.html#breakpoint https://docs.python.org/3/library/functions.html#breakpoint
- AtHeartEngineer 7y agoLol this is pretty funny. I like your style.