Reputation: 31548
I have installed virtualenv with --no-site-packages
option.
I have few doubts
If I use django with virtualenv then does it mean that my django site is completely cut off from system packages. I mean any of the package installed in system site packages won't be available?
I have installed all packages in virtualenv but not django. Do I also need to install Django in virtualenv as well?
Suppose I have some package which is not in virtualenv but that is available in main env, can I access it from main package or only one environment can run at one time?
Upvotes: 0
Views: 2664
Reputation: 5539
Yes you do, you can do that via pip or download from Django and run setup. In both cases you need to make sure that you have the virtualenv active, i.e. source ENV/bin/activate
The point of virtualenv is to keep your main system separate, you want to do that.
yes.
you should just install them in your virtualenv, it is better practice.
A really nice thing about virtualenv is that you can create a nice complete environment for your project. Then once things are working and stable you can pip freeze the packages and git your code and then you know if you share your project or move systems the whole thing is going to be easy to recreate and just work :)
--- update to comment --- at command line and assuming Linux type environment
$ cd
$ virtualenv --no-site-packages --distribute ENV
$ source ENV/bin/activate
$ pip install django
$ pip install all_the_packages_you_need
Now you can go into your django project and run python commands as normal and it will use your virtualenv "ENV" python and site-packages
Upvotes: 2