Django In Pycharm Community



Django Custom Tags in PyCharm Professional 2020.1 PyCharm started its life with Django support and our new release adds some useful improvements for Django coding. Let's take a look at support for custom Django tags in PyCharm Professional 2020.1. But First, One More Thing. As someone who's used both for development with python I'd say PyCharm Community is definitely my preference for python development. The tool suite they provide is great, the integrated vcs functionality is quite good, the interpreter itself is fantastic I've found and it just seems to me like a better development suite for python than vs code.

Pycharm

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. PyCharm is also available as a snap package. If you’re on Ubuntu 16.04 or later, you can install PyCharm from the command line. Sudo snap install pycharm-professional pycharm-community -classic. One of the features of PyCharm is that it includes a support for Django. With the ability of including JavaScript features within PyCharm, it can be considered as the best IDE for Django. The basic steps for creating a Django project in PyCharm IDE are given below −.

Introduction

There is a most important thing I want to remind before I start: to use the Python interpreter of remote server requires the professional version of PyCharm. The community version has no way to configure the remote Python interpreter. (If I make a mistake, please feel free to tell me.)

Django In Pycharm Community

Fortunately, in addition to spending money to buy it, you can apply for a free professional version if you are a student and have a school email address. One application can be valid for one year.

You can go to the following website to apply: https://www.jetbrains.com/pycharm/download/#section=windows

If you want to know how to install PyCharm, maybe you can refer to this article: PyCharm Installation Tutorial, A famous Python IDE

Okay, let's start!

Configure remote interpreter settings

First, I build a new project of the example.

Select File => Settings to open the setting window. Of course you can also use the shortcut key Ctrl + Alt + s to open it.

After opening, select Project: 'YOUR_PROJECT_NAME' => Project Interpreter in the left bar.

Click the gear in the upper right corner and select Add button. The add Python interpreter window pops up:

Select SSH Interpreter.

Select New server configuration, and fill in the connection settings in sequence. After selecting, select Next.

Enter the password of the connection account, and then select Next again.

Pycharm

For the remote Python interpreter, you can use ssh command to connect to it first, and use the following command to confirm where the Python interpreter is.

Usually the path is approximately:

Above this is the path of my Python interpreter.

It is not recommended to preset the location of the synchronization folder, but it is better to create it separately. The method to change the path is to click on the folder icon on the right of step 2 in the figure, and then select the folder on the right of Remote Path again to select the folder you want to synchronize remotely.

Select Finish to end the configuration of the remote interpreter.

Hint

If PyCharm does not feel smooth or a bit stuck during remote synchronization, it may be because its background has been detecting whether to synchronize all files in the current folder. You can go to Tools => Deployment => to turn off Automatic Upload. Maybe it will be smoother.

If there is no manual upload file to the remote synchronization folder under Deployment, you can enter Configuration for configuration.

After configuring in order, there is probably no problem.

Maybe you want to read:

Sep 17, 2015 · 2 Min Read · 3 Likes · 12 Comments
Photo by Nikolas Noonan on Unsplash

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.

Pycharm

Django configuration

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

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

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

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

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

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.

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:

And save and run.

Pycharm Professional Vs Community

PyCharm 2016

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

Pycharm Community Edition Setup

  1. In the Project Interpreter page, click

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

  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.

Pycharm Django App

Last updated: Apr 20, 2021