简体   繁体   English

如何在调试模式下启动服务器 - Pycharm

[英]How to start server in debug mode - Pycharm

I want to debug my code and put breakpoints. 我想调试我的代码并放置断点。 However I am not able to start my server in debug mode. 但是,我无法在调试模式下启动我的服务器。

I have a setup.sh file. 我有一个setup.sh文件。 It has multiple export statements and last statement is python manage.py runserver. 它有多个导出语句,最后一个语句是python manage.py runserver。 In manage.py I added DEBUG = True as shown below : 在manage.py中,我添加了DEBUG = True,如下所示:

if __name__ == "__main__":
 DEBUG = True

The application did not stop on debug points i had put. 应用程序没有停止我放置的调试点。

Alternatively, you may use the python "pdb" debugger. 或者,您可以使用python“pdb”调试器。 Just import pdb and call pdb.set_trace() below the line which might cause error. 只需导入pdb并在可能导致错误的行下面调用pdb.set_trace()。 It will stop at the that point of code during execution and you can debug and see whatever you want to! 它将在执行期间停在代码点,您可以调试并查看您想要的任何内容!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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