I wrote dynamic programming language from working to now. Most of my time also use print
(Python), console.log
(JS), puts
(Ruby) to debug any scripts or web apps. from my before experience, I only know Ruby had byebug
package which could write a byebug
line in your code and run it, it will show something information that you could debug in the terminal.
This is my first know debug method in dynamic languages … XD
In this article, I will take you to know how to debug Python apps by Pycharm which was I learn recently…😆
- Open your project and click the dropdown button
- Select
Edit Configurations
.
Click
+
➡️ SelectPython
➡️ Choose yourscript
orweb entrance file
➡️ SetEnvironment Variables
if your app needs ➡️Apply
andOK
.Click
+
adding a variable, fill the variable key and value column.
- The name would map your task name.
- Finally, you will get a task which like following name
api debug
(It’s my task name).
- Put red icon in a line(or two red icon become a scope), Click the
bug button
to start the debug mode🎉
- Then you can see code information(variables, library…) at IDE.
If you run web app, you need to give API a action, then debug mode will be trigger.
Conclusion
This is my first time using debug mode in dynamic languages by Python. Write down my experience when I forgot steps on another day… XD