How to install Django on Debian 9 using venv




Check python version

python3 -V


Output:

Python 3.5.3

 

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

sudo apt install python3-venv


Create a Project Directory.

mkdir my_projects

 

change directory

cd my_projects

create a new virtual environment:

python3 -m venv venv


Activate the virtual environment.

source venv/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