Issue
For the first time, I made an environment for Django with virtualbox and vagrant (CentOS 7).
But every tutorial I saw says I need to use pyenv or virtualenv. I think they are used to make a virtual environment for Django. But I don't know why I need to use pyenv or virtualenv. (For example, Cakephp3 doesn't need packages like pyenv or virtualenv.)
And I was using virtualbox and vagrant, which are already virtual environment, so I think I was making virtual environment inside another virtual environment. I am not sure if this is meaningful. Maybe pyenv and virtualenv are not necessary if I am using virtual environment like virtualbox or vmware?
Are they essential for Django? When I deploy Django in actual server, do I still need to use pyenv or virtualenv?
Solution
It is not essential but it is recommended to work in a virtual environment when you start working on Django projects.
Importance of the virtual environment.
A virtual environment is a way for you to have multiple versions of python on your machine without them clashing with each other, each version can be considered as a development environment and you can have different versions of python libraries and modules all isolated from one another.
In a most simple way, a virtual environment provides you a development environment independent of the host operating system. You can install and use the necessary softwares in the
/bin
folder of the virtualenv, instead of using the software installed on the host machine.Many a time different projects need different versions of the same package and keeping every projects in seperate virtual environements helps a lot.
It is strongly recommended to set up separate virtualenv for each project. Once you are used to it, it will seem fairly trivial and highly useful for development, removing a lot of future headaches.
Answered By - Astik Anand