Django shell run configuration

Answered

I have several manage.py scripts in my Django app so I wanted to automate running the shell for a particular manage.py creating a new run configuration, so it ran my_custom_manage.py passing the shell option.

I activated  the "Show command line afterwards" option to, well, show the command line after running the script. And also because it has a nice color scheme and autocomplete options. However after running it the following "bad" things happen:

1) the command line shows even before the Python Console has finished starting.

2) it only executes the first command and it does not output anything, i.e. if I enter 2+3 it doesn't show 5 but a newline.

3) it is impossible trying to execute a second command, as the following warning shows up: "Previous command is still running. Please wait or press Ctrl+C in console to interrupt".

So what should I do?

 

Bonus question: I'd like to execute a couple of lines after starting up that script, mainly to import some recurrent modules. How could I do that from the run configuration?

2 comments
Comment actions Permalink
Official comment

Hello.

PyCharm does not support manage.py based run configuration (see https://youtrack.jetbrains.com/issue/PY-20652), but even if you run your command using Django manage.py console (Tools |  Run manage.py command) you may face troubles with your custom console. If that is your case, please create feature request in https://youtrack.jetbrains.com

 

Please sign in to leave a comment.