Download Python
Verify Installation
Open your terminal or command line interface (CLI).
Check the version of Python installed:
python --version
Check the version of pip:
pip --version
Create a Virtual Environment
Navigate to the directory where you want to create your project. For example:
cd Users/Documents/project
Create a virtual environment:
python -m venv myvenv
Replace myvenv
with your preferred virtual environment name.
Activating the Virtual Environment
Depending on your OS, activate the virtual environment:
Verify pip in the Virtual Environment
After activating the virtual environment, ensure pip is correctly set up:
pip --version
Install Django
With your virtual environment activated, install Django using pip:
python -m pip install django
Verify Django Installation
Check the installed Django version:
python -m django --version
manage.py migrate
to create database tables, ensure Django has the necessary permissions (SELECT, INSERT, UPDATE, DELETE) for database operations.settings.py
under the DATABASES
configuration.You've now set up your development environment with Python, pip, a virtual environment, and Django. Activate your virtual environment whenever working on Django projects to maintain dependency isolation and manageability.