-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Building SPAs with Django and HTML Over the Wire
By :

PyCharm is highly popular because it’s a tool specially prepared to work with Python and it also includes interesting integrations with databases, Git, HTTP clients, environments, and the like. One of the most used is certainly the one related to Docker, so I will use this fantastic IDE in future examples. However, as I said before, it is not mandatory to use it; there are enough alternatives to please everyone. All code and activities shown in this chapter will work independently of the editor.
To set up the IDE, follow these steps:
hello.py
). It’s not possible to run the Python code if you don’t use the terminal; PyCharm doesn’t know where the Python interpreter, or executable, is otherwise. It’s inside a Docker image that the operating system can’t access, for now.Figure 1.1 – Open the Python file
Figure 1.2 – Installing the Docker plugin
Figure 1.3 – Connecting with Docker
Docker
in the Name field, for example, and activate Unix socket. At the bottom, you will see the Connection successful message. Figure 1.4 – Adding the Python interpreter
hello.py
and then Run ‘hello’.Figure 1.5 – Running Python with PyCharm
print
statement.Figure 1.6 – Viewing the Python execution log through Docker integration
docker-compose.yaml
file, we can run the containers individually.Figure 1.7 – Launching containers through Docker integration
PyCharm is already integrated with Docker and is able to launch Python with its dependencies in isolation from the operating system. We are ready to work directly with Django. We are going to create a simple project using the official Django client to have a minimal structure when developing.