Differentiate mkvirtualenv and mkproject for virturalenvwrapper

I am talking about Doug Hellman virtualenvwrapper . Well, once we have installed virtualenvwrapper, we have to edit the .bashrc file as described here

what we do, we add the following three lines of code:

export WORKON_HOME=$HOME/.virtualenvs export PROJECT_HOME=$HOME/Devel source /usr/local/bin/virtualenvwrapper.sh 

where .virtualenv is the directory in which venvs will be hosted. Devel is the directory where the code will be located.

Observation 1: when I do mkvirtualenv proj1 what happens is a directory called proj1 created inside .virtualenv but NOT inside Devel.

Observation 2: When I do mkproject proj1 , a directory is created inside .virtualenv, as well as inside Devel.

Now the questions are:

  • Please explain this with remark 1.

  • What if two projects have the same requirements and I want to use one env and do not want to start by creating another virtualenv and reinstalling the same one that is installed. How to do it?

+4
source share
1 answer
  • This is the expected behavior. The mkvirtualenv team creates a virtual environment, but it does not create a project for you. Some people do web development with Django, others do scientific programming in Python, so it would be too difficult for mkvirtualenv to set up something for you. You can simply create a directory yourself if you are starting a new project.

  • If both projects are in different directories, you can activate the virtual environment, and then go to any project directory to work on it. Then you can execute the code of each project, being in this virtual environment. Thus, you do not need to set requirements again in the new virtual environment.

+4
source

Source: https://habr.com/ru/post/1402746/


All Articles