How To Install Django in Virtual Environment

Hello fellas, in this post we are going to see how we can install django in a virtual environment instead of installing to our workspace. Before we begin i want to let you know that there are several ways to install django. Ofiicial installation doc is available here. Let’s begin …

Prerequisites

You must have installed below packages. If not installed yet, install them now and after successful installation proceed.

For simplicity i have divided whole process into 2 major steps:

Setup Virtual Environment

Install Django

To install django to the virtual environment created, you have to activate virtual env which you already done in previous step.

Now you can do all your django work in virtual environment.

After you finished your work and want to work on local environment, you have to deactivate the virtual environment. Deactivating a virtual environment don’t cause any data loss, it just log out you from that env.

My terminal snippet

[email protected]:~/Documents/chankruze/web_dev/jekyll_dev/geekofia$ virtualenv hello_venv
Using base prefix '/usr'
New python executable in /home/chankruze/Documents/chankruze/web_dev/jekyll_dev/geekofia/hello_venv/bin/python3
Also creating executable in /home/chankruze/Documents/chankruze/web_dev/jekyll_dev/geekofia/hello_venv/bin/python
Installing setuptools, pip, wheel...
done.
[email protected]:~/Documents/chankruze/web_dev/jekyll_dev/geekofia$ source hello_venv/bin/activate
(hello_venv) [email protected]:~/Documents/chankruze/web_dev/jekyll_dev/geekofia$ cd
(hello_venv) [email protected]:~$ deactivate 
[email protected]:~$

I hope this post is helpful !

o EOP o