REPL and Django console

Hi guys,

Today we want to give you a small review of a new feature in PyCharm – REPL and Django consoles.
Using such consoles is pretty essential for each developer, thus having them tightly integrated in an IDE is pretty useful.
You don’t need switching back and forth to shell anymore!

The console is accessible using the Tools menu item:

In this short guide we’ll run the Django console. Please note that the action to run the Django console is only available in Django projects.

On the picture you can see the default console prompt, pretty familiar, isn’t it?
To easily tell input from output, the output messages have light grey background color. (As all other colors, you can configure this in File | Settings | Colors And Fonts).

These built-in consoles have their own history, you can easily navigate through commands by pressing Ctrl+Up/Down.

One can ask, what advantages does built-in console have comparing to the shells ones?

  • On-the-fly syntax check with inspections
  • Brace and quotes matching
  • Automatic insertion of paired braces and quotes on typing
  • Code completion and resolve

Here we have a couple of screenshots to prove this:

and

That’s all folks! You’ll be able to try this new features in coming PyCharm EAP! Stay tuned!

Develop with pleasure!
-JetBrains PyCharm Team

This entry was posted in Cool Feature and tagged , . Bookmark the permalink.

16 Responses to REPL and Django console

  1. Ben says:

    I love pycham, I’ve been using it for all mof my latest projects (it integrates really well with buildout).

    It’s a great idea to provide a console, but it would be awesome if you could provide ipython somehow.

    Ben

  2. Pingback: JetBrains PyCharm Blog » Blog Archive » REPL Console completion

  3. jacob says:

    The REPL is a nice feature. Command is a must-have though, and it seems to be missing. To make it a real killer app for me, give it cmd history across sessions. All around PyCharm is awesome, thanks!

  4. jacob says:

    Oh, I just came across paste from history. Very nice.

  5. jacob says:

    But, yeah, still need cmd history…

  6. Oleg Shpynov says:

    @jacob, actually console has history Ctrl+Up/Down.
    Feel free to submit feature request to PyCharm issue tracker at: http://youtrack.jetbrains.net/issues/PY

  7. Oleg Shpynov says:

    We’ve been working hard and made integrated console extract completion and quick documentation from runtime. Check this out in coming PyCharm and Python plugin for IntelliJ IDEA.

  8. santi says:

    Where exactly can one change the colors of the python REPL? With my custom theme I cannot read the printed messages and I cannot find which color corresponds to this in tehe settings menu.

    • yole says:

      santi,
      You should be able to configure the console colours using the different “Console” items in Editor / Colors & Fonts / General

  9. Kresimir says:

    As Ben already said, providing a way to easily connect IPython to PyCharm would be great

    A good IDE with IPython support would be invaluable to me since I use python mostly for data preparation and analysis and have found IPython features to be great for interactive sessions and similar stuff.

    I currently use Eclipse + PyDev which is sufficient for my needs but would imediatly switch to (almost) anything giving me IPython directly from IDE.

  10. jelle says:

    +1 for ipython integration!
    What’s great about pydev is that code in the editor can be easily send to the shell. That would be a most welcome addition to pycharm.

  11. Vj says:

    Can I run manage.py commands in the Django console?

    I know Ctrl + Alt + R can be used to run manage.py tasks – but can I use the console to run them ? After all the purpose of console is to be able to control from the command-line.

    I am using 1.2 EAP / RC.

  12. sash says:

    Hi,
    in your console I get syntax error when I use multiple inputs as in the following code:

    property = dict(square_feet=input(“Enter the square feet: “), beds=input(“Enter number of bedrooms: “), baths=input(“Enter number of baths: “))

    This does not happen in the native Python Shell

  13. Alvin Mites says:

    IPython support has been filed as an issue for development

    http://youtrack.jetbrains.net/issue/PY-4504?projectKey=PY

    Could probably be completed using a plugin, though I haven’t looked into it.

  14. Justin says:

    Does the django console allow debugging? I can’t seem to find that feature.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>