This guide will walk you through setting up a Django project using a virtual environment.
- Python installed on your system (Download Python)
- Basic understanding of the command line
-
Install virtualenv:
pip install virtualenv
-
Create a virtual environment:
virtualenv <env_name>
Replace
<env_name>
with the name you want to give your virtual environment. -
Activate the virtual environment:
On Windows:
<env_name>\Scripts\activate
On macOS/Linux:
source <env_name>/bin/activate
-
Install Django:
pip install Django
-
Create a new Django project:
django-admin startproject <project_name>
Replace
<project_name>
with the name you want to give your Django project. -
Navigate to the project directory:
cd <project_name>
-
Run the Django development server:
python manage.py runserver
This will start the development server, and you can access your Django project at
http://127.0.0.1:8000/
in your web browser.