FIRST PROJECT IN DJANGO

DjangoVIRTUAL ENVIRONMENTS

First Project
Virtual Environments

The first thing we have to do to work on virtual environments is to create a folder, once the created folder has been selected, with the cd command in Windows, or ls in Linux we give the following command:

python -m venv virtual_name_environment

This command creates the virtual environment with all the files necessary for the project to work, including Python binaries. The following image shows the virtual environment just created in the visual studio code.

Create Virtual Environment

Once the environment has been created, it must be activated with the following command:

venv\Scripts\activate

If everything went well on the left side, in brackets you should see the name you have chosen for your virtual environment, as shown in the image.

venv

Note: I am using Windows as the operating system, the above commands refer to this system. If you are using another system refer to the documentation to create the virtual environments.

VISUAL STUDIO CODE SETUP

Install the following extensions including Emmet.

Extensions

CREATION OF THE FIRST PROJECT IN DJANGO

First Project

Within the virtual environment already activated, we issue the following command to install Django:

pip install django

Inside Lib\site-packages of the virtual environment, check that Django has actually been installed.

First Project

We will analyze in the next post the project files created by Django, we will also implement our first application.

First Project

With the project creation command, Django also creates a very useful web server during development. Now let’s go to the directory containing the manage.py file and start the web server to verify that the creation of the project was successful. We issue the following command:

python manage.py runserver

Run Server

Connect to the localhost port 8000 address and if everything went well we get the following screen:

Succesfull installation

PREVIOUS POST DJANGO

PREVIOUS POST LINKS