Ruddra.com

How to configure Django and Tornado in PyCharm Community Edition

How to configure Django and Tornado in PyCharm Community Edition

I think, Pycharm is THE best IDE for developing python. But unfortunately, the professional edition is not free. But community edition is good enough for doing debugging, integrating GIT etc.

Normally its easy to use the community edition for django and tornado’s debugging/running if you know how to configure.

Django configuration

For django’s configuration, there is 5 easy steps:

First: Go to edit configuration and click on it(like the below pictures).

pycharm

pycharm

Second: Click on the (+) mark in top-left corner and add python configuration.

pycharm

pycharm

Third: Click on the Script, and for django select the manage.py which resides on the project directory.

pycharm

Fourth: Add runserver as Scripts parameter or any other django commands.

pycharm

Fifth: Click Apply and if your python interpreter is correctly configured, then clicking on the run command should run the project, and debugging will work as well.

pycharm

Tornado configuration

There is only 1 Step:

Just follow the first and second step from above configuration and click the *.py file you want to run for tornado project in the Script, i.e. this file should contain lines like below:

    if __name__ == "__main__":
        application.listen(8888)
        tornado.ioloop.IOLoop.current().start()

And save and run.

PyCharm 2016

In 2016 edition, to add an existing virtual environment to the list of available interpreters

  1. In the Project Interpreter page, click

    pycharm
    icon.

  2. In the drop-down list, choose Add local.

    pycharm

  3. In the Select Python Interpreter dialog box that opens, choose the desired Python executable, located inside the virtual environment folder, and click OK.

Go to Jetbrain’s documentation for more information.

Last updated: September 16, 2020


Share Your Thoughts
M↓ Markdown