You are on page 1of 33

Django Virtual Environment

BY :KAMALPREET KAUR
SCHOOL OF COMPUTER SCIENCE AND ENGINEERING
Django Virtual Environment

 A Django virtual environment is a self contained directory that houses a specific Python
environment for Django project.
 It allows you to isolates the dependencies and libraries for that particular project ,ensuring
that different project can have their own unique sets of dependencies without interfering
with each others.
 Python has a tool called venv that creates these isolated environment.
.

 Once activated ,the virtual environment provides its own Python executable and its own
set of libraries separate from the system –wide Python installation.
 python –m venv myenv
 myenv\Scripts\activate.bat -For Window
 source myenv/bin/activate -Linux
Installing Django

 pip install Django


 python –m django version
Working on VS

 Open VS
 Open new terminal
 Change the path using cd where the project is available
 Make a project using (mkdir project)
.

 Go inside the project


Created virtual environment
Inner view of myenv
Django installation
Django installation

 Checking the Django version


 Python –m Django version
Creating project without entering into
environment
Working with app
Working with app
Working with app
Including myapp.url
.
Result

 .
Writing content in paragraph-”””
Results

 .
Adding f string
Iterating the dictionary
Providing path to dictionary

 .
Output
Dynamic URL in Django

 Dynamic route means there will be only one route and values going to be changed.
 Dynamic pages can be made on three basis:
a) int
b) str
c) slug
Adding dynamic path in url.py
Creating the function with dynamic parameter
Dynamic Output
Dynamic Output(parameter dynamic)
Dynamic Output(parameter dynamic)
Dynamic string output
Dynamic routing-using slug
Output

You might also like