How to install Django on Debian 9 using virtualenv

virtualenv is a tool used to create an isolated workspace for a Python application.
Install virtualenv by running:

sudo apt install python python3 virtualenv


Create a Project Directory.

mkdir all_projects

 

change directory

cd all_projects

create a new virtual environment:

virtualenv -p python3 env


Activate the virtual environment.

source env/bin/activate


install the Django package using pip.

pip install Django


run the following command to create a new project

django-admin startproject django_project

 

To change to your directory, type cd and press

cd django_project

To apply migration, we need to run migrate command as follows

python manage.py migrate

 

Creating an admin user

python manage.py createsuperuser

 

Use the following command to start the server:

python manage.py runserver

 

visit http://127.0.0.1:8000/ with your Web browser.
The install worked successfully! Congratulations!

 

open the admin panel
http://127.0.0.1:8000/admin
 

Thank You



Comments