Here is the step-by-step process to install Django on your system
1. Install Python
Django requires Python, so make sure Python is installed on your system.
- Check Python version:
python --version
or
python3 --version
- Download Python (if not installed):
Go to Python’s official website and download the latest version.
2. Install pip (Python Package Manager)
Pip usually comes pre-installed with Python. To verify, run:
pip --version
If not installed, you can install pip using:
python -m ensurepip --upgrade
3. Create a Virtual Environment (Optional but Recommended)
It’s best to create a virtual environment for Django projects to avoid conflicts with other projects.
- Create virtual environment:
python -m venv env
Activate virtual environment:
- Windows:
.\env\Scripts\activate
macOS/Linux:
source env/bin/activate
4. Install Django
Once the virtual environment is activated, install Django using pip:
pip install django
To verify the installation, run:
django-admin --version
5. Create a Django Project
You can now create a Django project:
django-admin startproject myproject
cd myproject
6. Run the Development Server
To test your Django installation, start the development server:
python manage.py runserver
Open your browser and visit http://127.0.0.1:8000/
. If you see the Django welcome page, you’re good to go!