Installing Django
Welcome to Django! Follow these steps to quickly set up and install Django on your system.
Step 1 : Prerequisites
Before you begin, ensure you have the following prerequisites installed on your system:
- Python : Django is a Python web framework, so you need to have Python installed. Download and install Python from [ python.org ]
Step 2 : Install virtualenv (if not already installed)
If you don't have virtualenv installed, run the following command to install it :
pip install virtualenv
# Create a virtual environment named "myenv"
python -m venv myenv
# Activate the virtual environment# (Choose the appropriate command for your operating system)# Windows :
myenv\Scripts\activate
# MacOs / Linux : source myenv/bin/activate
Step 4 : Install Django
With your virtual environment activated, install Django using the following command :
# Install the Django web framework using pip
pip install django
# Check the installed Django version
django-admin --version
Step 6 : Start a New Project
Now that Django is installed, you can create a new project. Navigate to the directory where you want to create your project and run :
# Create a new Django project named "myproject"
django-admin startproject myproject
# Navigate to the "myproject" directory
cd myproject
# Start the Django development server
python manage.py runserver