调试Django Manage.py自定义命令Pycharm [英] Debuging Django Manage.py Custom commands Pycharm

查看:170
本文介绍了调试Django Manage.py自定义命令Pycharm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习如何使用PyCharm调试django应用程序。在应用程序中,我们有几个自定义的manage.py命令。如果我通过终端(外部或Pycharm的终端)在那运行,则它们运行良好。



如果我尝试从PyCharm运行它们(工具->运行manage.py任务),我可以调试,但出现以下错误:

 未知命令:'add_question'
键入'manage.py help '供使用。

我在使用PyCharm之前就开始从事Django项目的工作,因此我通过django-admin创建了它,并且



任何帮助都是有帮助的,无论是从PyCharm内部运行命令还是进行连接将PyCharms终端连接到调试器,以便在从PyCharms终端运行时进行调试。

解决方案

该解决方案位于



现在,您可以运行此配置(运行>运行...> Your_configuration_name)并对其进行调试(运行>调试...> Your_configuration_name)。


I am trying to learn how to debug a django application with PyCharm. In the application we have several custom manage.py commands. If I run there via terminal (external or Pycharm's terminal) they run fine.

If I try to run them from PyCharm (Tool -> run manage.py task) so I can debug, I get the following error:

Unknown command: 'add_question'
Type 'manage.py help' for usage.

I started working on the Django Project before using PyCharm, so I created it via django-admin, and we are adding it to pycharm as OpenDirectory->Select the project.

Any help would be helpful, be it to manage to run the command from inside PyCharm, or to connect PyCharms terminal to the debugger so that I can debug when running from PyCharms terminal.

解决方案

The solution is in another answer, though a little outdated. Quick update for PyCharm 2016.3:

  • Run > Run... > Edit Configurations... (Note: you can add configurations by doing both "Run..." and "Debug...")
  • Click green + (plus sign)
  • In the drop down menu, choose Django Server.
  • Check "Custom run command" and enter your command (the part that goes after manage.py in the console.
  • Make sure "Port" and "Host" are empty. If not—make them empty.
  • Change "Name" to your liking.
  • "Apply" and "Close"

Now you can run this configuration (Run > Run... > Your_configuration_name) and debug it (Run > Debug... > Your_configuration_name).

这篇关于调试Django Manage.py自定义命令Pycharm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆