将参数传递给PyCharm自定义管理命令

时间:2022-04-29 23:19:40

I'm testing out PyCharm and I bumped into an odd problem where I can't specify arguments to my custom admin commands. In the Run/Debug Configurations I added a runserver configuration, cleared the port and checked the Custom run command and added the name of my command.

我正在测试PyCharm,我碰到了一个奇怪的问题,我无法为自定义管理命令指定参数。在运行/调试配置中,我添加了一个runserver配置,清除了端口并检查了自定义运行命令并添加了我的命令名称。

That works fine, but when trying to run it with arguments such as my_command 100 the console prints out Unknown command: 'my_command 100' which seems to happen when I run it manually adding quotes around the whole command.

这样可以正常工作,但是当尝试使用my_command 100之类的参数运行它时,控制台会打印出未知命令:'my_command 100',这似乎发生在我手动运行它时,在整个命令周围添加引号。

Anyone knows where I can specify the arguments?

谁知道我可以在哪里指定参数?

Thanks.

谢谢。

2 个解决方案

#1


7  

Woops, got it, you add them to Additional options under the host/port.

Woops,得到它,你把它们添加到主机/端口下的附加选项。

#2


2  

I ran into this issue when trying to change the runserver to runserver_plus from django-extensions so that I can run with SSL turned on.

尝试将django-extensions中的runserver更改为runserver_plus时遇到此问题,以便我可以在启用SSL的情况下运行。

This works:

这有效:

将参数传递给PyCharm自定义管理命令

#1


7  

Woops, got it, you add them to Additional options under the host/port.

Woops,得到它,你把它们添加到主机/端口下的附加选项。

#2


2  

I ran into this issue when trying to change the runserver to runserver_plus from django-extensions so that I can run with SSL turned on.

尝试将django-extensions中的runserver更改为runserver_plus时遇到此问题,以便我可以在启用SSL的情况下运行。

This works:

这有效:

将参数传递给PyCharm自定义管理命令