Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VirtualEnv - Should I ignore the venv folder?

Tags:

I am starting to understand the advantages of virtualenv. Now, I have created virtualenv folder named venv by doing virtualenv venv.

Now my question is, Is it useful to push this folder to github or should I add it to .gitignore?

like image 478
Sreekar Mouli Avatar asked Aug 02 '18 12:08

Sreekar Mouli


People also ask

Is it safe to delete venv folder?

Yes, delete the directory. it's where executables for the venv and modules and libraries and entire other stuff for venvs is kept.

Should I always use venv?

Always use a Virtual Environment You are in control of which packages versions are installed and when they are upgraded. You can have as many venvs as you want.

Should venv be hidden?

venv suggests it's private. So would not recommend that at all. Some tools use . venv but in that case the intent is that the user will not interract with the venv directly, but rather through the tool (e.g. poetry).

Should I use virtualenv or venv?

These are almost completely interchangeable, the difference being that virtualenv supports older python versions and has a few more minor unique features, while venv is in the standard library.


1 Answers

You should add it to gitignore file. Then, you should create requirements.txt file and populate it with the packages you have installed. Then, on your production server, create the virtual environment and run pip install -r requirements.txt.

Read this to learn more about the requirements file.

like image 60
Nestor Yanchuk Avatar answered Sep 21 '22 12:09

Nestor Yanchuk