Before building websites with Django, you need to prepare your development environment correctly. A good environment helps you install the right tools, avoid dependency problems, and run your Django projects smoothly. In this tutorial, you will learn how to install Python, create a virtual environment, install Django, start your first project, and run the local development server.
This is one of the most important first steps for every Django beginner because it creates the foundation for all the tutorials that come next.
A development environment is the set of tools and software you use to write, run, and test your code.
For Django development, the basic environment usually includes:
Once these tools are installed and configured, you can start building Django applications on your machine.
Django is built with Python, so the first thing you need is Python installed on your computer.
Open your terminal or command prompt and run:
python --versionOn some systems, especially Linux and macOS, you may need:
python3 --versionIf Python is installed, you will see a version number such as:
Python 3.12.2If it is not installed, download it from the official Python website and install it.
When installing Python on Windows, make sure to check the option:
Add Python to PATH
This allows you to use Python from the command prompt.
pip is Python’s package manager. It is used to install Django and other Python libraries.
To check if pip is installed, run:
pip --versionOr:
pip3 --versionYou should see something like:
pip 24.0 from ...In most Python installations, pip is already included by default.
You can write Django code in any text editor, but some editors make development easier.
Popular choices include:
For beginners, VS Code is often a very good choice because it is simple, modern, and has many useful extensions for Python and Django.
Useful extensions in VS Code include:
A virtual environment is an isolated Python environment for a specific project.
This means each Django project can have its own:
Without a virtual environment, packages are installed globally on your system, which can create conflicts between projects.
One project may use Django 4.x, while another may use Django 5.x. A virtual environment keeps them separate.
Using a virtual environment is considered a best practice in Python development.
Before creating the virtual environment, make a folder for your Django project.
Example:
mkdir my_django_project
cd my_django_projectThis folder will contain your virtual environment and your Django project files.
Now create the virtual environment.
python -m venv venvpython3 -m venv venvThis creates a folder named venv containing an isolated Python setup for your project.
After creating the virtual environment, you must activate it.
venv\Scripts\activatesource venv/bin/activateWhen activated, your terminal usually shows something like:
(venv)This indicates that you are now working inside the virtual environment.
Once the virtual environment is active, install Django using pip:
pip install djangoThis downloads and installs Django inside the virtual environment.
django-admin --versionYou should see the installed Django version number.
Now that Django is installed, you can create your first project.
Run:
django-admin startproject config .This creates a new Django project in the current folder.
. at the end?The dot tells Django to create the project in the current directory instead of creating an extra nested folder.
If you prefer, you can also write:
django-admin startproject configThis creates a separate folder named config.
After creating the project, you will see files like these:
manage.py
config/
Inside the config folder, you will usually find:
__init__.pysettings.pyurls.pyasgi.pywsgi.pymanage.pyThis is the main command-line utility for interacting with your Django project.
settings.pyThis contains the project configuration, such as installed apps, database settings, language, timezone, and static files settings.
urls.pyThis defines the main URL routes of the project.
wsgi.py and asgi.pyThese are used for deployment and server communication.
To start the local Django server, run:
python manage.py runserverOn some systems:
python3 manage.py runserveYou will see output similar to:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
April 02, 2026 - 10:00:00
Django version 5.x, using settings 'config.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.Now open your browser and visit:
http://127.0.0.1:8000/If everything is working, you will see the default Django welcome page.
That page confirms that Django is installed correctly and your project is running.
When you see the default Django page, it means:
This is a very important milestone for a beginner because it proves the environment is correctly configured.
Here are some useful Django commands you will use often:
python manage.py runserverpython manage.py makemigrationspython manage.py migratepython manage.py createsuperuserpython manage.py startapp myappYou do not need to master all of these now, but it is useful to know they exist.
Sometimes you may want to install a specific Django version for compatibility.
Example:
pip install django==5.0.4This installs exactly that version.
To see installed packages:
pip listTo save project dependencies:
pip freeze > requirements.txtThis creates a requirements.txt file, which is very useful when sharing or deploying your project.
A good beginner workflow is:
This workflow is clean and professional.
python is not recognizedThis usually means Python is not installed correctly or not added to PATH.
Solution: reinstall Python and make sure PATH is enabled.
pip is not recognizedThis usually means pip is missing or Python scripts are not in PATH.
Solution: reinstall Python or use python -m pip install django.
Sometimes terminal settings or execution policies block activation.
Solution: make sure you are using the correct activation command for your operating system.
No module named djangoThis usually means Django is not installed in the active environment.
Solution: activate the virtual environment, then run:
pip install djangoThis may happen because of syntax errors, missing files, or port issues.
Solution: read the error message carefully and fix the problem step by step.
The main difference between operating systems is usually:
python vs python3)But the overall Django workflow is almost the same on all systems.
A proper setup is important because it helps you:
Many beginner problems in Django come from poor environment setup, so learning this correctly from the beginning saves a lot of time later.
In this tutorial, you learned how to prepare a Django development environment from scratch. You saw how to install Python and pip, choose a code editor, create and activate a virtual environment, install Django, create a project, and run the development server.
These steps are the technical foundation for all future Django development. Once your environment is ready, you can begin creating apps, views, templates, and models with confidence.
pip install django.django-admin startproject.python manage.py runserver.manage.py?Your Django environment is now ready. This is the first practical step toward building real web applications with Python. Once installation and setup are complete, the next step is understanding how Django projects are organized internally.