简体   繁体   English

如何配置Pycharm来调试django

[英]How to configure Pycharm to debug django

I am trying to set up Pycharm3.0 to be able to debug the django project.. I cannot get it to work. 我正在尝试设置Pycharm3.0以便能够调试django项目..我无法让它工作。 Any help is greatly appreciated..! 任何帮助是极大的赞赏..! :-) :-)

I checked the django support is there: 我检查了django支持是否存在: 在此输入图像描述

I then configured the Run/debug configuration settings as following: 然后,我将运行/调试配置设置配置如下:

在此输入图像描述

. sitee is the project folder. sitee是项目文件夹。

When I hit the debug button, I got error: 当我点击调试按钮时,出现错误:

/usr/bin/python2.7 manage.py runserver /home/tee/Downloads/pycharm-3.0.2/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 40239 --file /home/tee/PycharmProjects/sitee/account/views.py Usage: manage.py runserver [options] [optional port number, or ipaddr:port] /usr/bin/python2.7 manage.py runserver /home/tee/Downloads/pycharm-3.0.2/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 40239 --file / home /tee/PycharmProjects/sitee/account/views.py用法:manage.py runserver [options] [可选端口号或ipaddr:port]

Starts a lightweight Web server for development and also serves static files. 启动轻量级Web服务器以进行开发,并提供静态文件。

manage.py: error: no such option: --multiproc manage.py:错误:没有这样的选项: - multiproc

Process finished with exit code 2 进程以退出代码2完成

It looks as if you are trying to debug using the 'Python' Run/Debug configuration rather than the 'Django server'. 看起来好像是在尝试使用'Python'运行/调试配置而不是'Django服务器'进行调试。 Check your left hand column, the one that lists your Run/Debug configs and the defaults that PyCharm provides. 检查左侧列,列出Run / Debug配置的列和PyCharm提供的默认值。 Do you see "Django server"? 你看到“Django服务器”了吗?

If so, clone that one and use it. 如果是这样,请克隆那个并使用它。 You hardly need to specify any parameters, it does a lot with the defaults straight out of the box. 您几乎不需要指定任何参数,它可以直接使用默认设置。

I was doing the same thing with PyCharm 2019.I had no trouble. 我和PyCharm 2019做了同样的事。我没有遇到麻烦。 I set the script path to my manage.py file added runserver as the parameter and set the working directory to my source drive. 我将脚本路径设置为我的manage.py文件添加了runserver作为参数,并将工作目录设置为我的源驱动器。

运行/调试配置

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

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