Where should virtualenvs be created?

前端 未结 5 1267
情深已故
情深已故 2020-11-28 01:31

I\'m confused as to where I should put my virtualenvs.

With my first django project, I created the project with the command

django-admin.py startproj         


        
5条回答
  •  佛祖请我去吃肉
    2020-11-28 02:26

    Changing the location of the virtualenv directory breaks it

    This is one advantage of putting the directory outside of the repository tree, e.g. under ~/.virtualenvs with virutalenvwrapper.

    Otherwise, if you keep it in the project tree, moving the project location will break the virtualenv.

    See: Renaming a virtualenv folder without breaking it

    There is --relocatable but it is known to not be perfect.

    Another minor advantage: you don't have to .gitignore it.

    The advantages of putting it gitignored in the project tree itself are:

    • keeps related stuff close together.
    • you will likely never reuse a given virtualenv across projects, so putting it somewhere else does not give much advantage

提交回复
热议问题