Django: Installing and configuring your development environment
4 min published: 11/19/2025
Django is a high-level framework that encourages rapid development and pragmatic design.
Its “batteries included” approach means that it comes with a multitude of ready-to-use features, allowing you to focus on your application’s logic rather than reinventing the wheel.
The goal of this article is simple: to guide you step by step through installing Django and setting up a clean, robust development environment. This is the crucial first step in building solid, scalable web applications.
Prerequisites
Before we get started, let’s make sure you have everything you need. Don’t worry, the list is short:
- Basic knowledge of Python: You don’t need to be an expert, but an understanding of basic concepts such as variables, functions, and data structures will be very useful.
- A terminal or command line: This is where we’ll type our commands. Whether you’re on Windows (PowerShell, CMD), macOS (Terminal), or Linux, the important thing is to be comfortable using it.
- Python and
pipinstalled: Django is a Python framework, so Python is essential.pipis Python’s package manager, and it is usually installed by default with recent versions of Python.
To check if Python and pip are installed, open your terminal and type the following commands:
python --version
pip --version
If you see version numbers, you’re ready to go! If not, go to the official Python website to install it.
Installing Django
The virtual environment: an essential practice
In Python development, it is essential to work in a virtual environment. This is an isolated space that contains a Python installation and all the dependencies specific to your project.
Why is this so important?
- Isolation: You avoid package version conflicts between your different projects.
- Reproducibility: You can easily recreate your project environment on another machine.
- Cleanliness: Your global Python installation remains clean.
Let’s create our virtual environment. Choose a folder for your project, open your terminal in that location, and type the following command:
# Create a virtual environment named "env"
python -m venv env
Now activate it:
# On Windows
env\Scripts\activate
# On macOS/Linux
source env/bin/activate
Once activated, the name of the environment ((env)) will appear in your terminal.
Installing Django with pip
Now that we are in our virtual environment, installing Django is a breeze. Use pip:
pip install django
To verify that the installation was successful, you can display the Django version:
django-admin --version
Creating your first Django project
With Django installed, it’s time to create the structure of our project. Django provides a command-line utility, django-admin, to automate this task.
django-admin startproject myproject .
Let’s analyze this command:
startprojectis the command to create a project.myprojectis the name we give to our project.- The
.at the end is very important: it tells Django to create the project in the current directory, which avoids unnecessary folder nesting.
This command generates the following tree structure:
myproject/
__init__.py
asgi.py
settings.py
urls.py
wsgi.py
manage.py
manage.py: Your best friend for interacting with your project (starting the server, managing the database, etc.).myproject/: Your project’s Python package.settings.py: Your project’s central configuration file.urls.py: The file that defines your site’s routes (URLs).asgi.pyandwsgi.py: Entry points for web servers.
Database configuration
By default, Django is configured to use SQLite, a lightweight database that is stored in a single file. It is the perfect choice for development and for many small and medium-sized applications.
Open the myproject/settings.py file and look for the DATABASES section:
# myproject/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR/'db.sqlite3',
}
}
For now, we don’t need to change anything. Django will automatically create the db.sqlite3 file when we run the first migration.
If your project requires a more robust database such as PostgreSQL, you can also configure it in this section. We will cover this topic in a future article.
Launching the development server
Everything is in place! It’s time to see our project in action. To do this, we will use Django’s built-in development server.
Before launching the server, it is recommended that you apply the initial migrations. These are scripts that prepare the database for Django’s core applications (such as authentication).
python manage.py migrate
Now launch the server:
python manage.py runserver
Open your browser and go to http://127.0.0.1:8000/.
You should see the Django welcome page, with a rocket ready to take off. Congratulations, your Django project is up and running!
Conclusion
You now have everything you need to get started with Django.
You have set up a clean and functional development environment, installed the framework, and launched your very first project.
The next step will be to bring your project to life by creating your first application and exploring the concepts of models and views.