Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is virtualenv recommended for django production server? [closed]

I have always been using virtualenv for testing my app in localhost since I have isolated environment and can safely test new release of packages.

Now It comes the time when I have to deploy my app to a production server. I am wondering if I should also use virtualenv for production server or just normal installation should do. Since it's production server I can always use the correct version that I tested in the dev server (under virtual-env)

like image 261
w00d Avatar asked Feb 18 '12 00:02

w00d


People also ask

Is virtual environment necessary for Django?

It is definitely recommended. If you are starting fresh and using the latest versions, you do not NEED to use it however it is good practice to just install virtualenv and start using it before you install django.

Should Python use virtual environment in production?

Yes, a virtualenv is quite suitable for production -- we have (very) large Python-using customers running their apps inside of a virtualenv, and it works very well to keep them isolated from the system Python configuration.

What is the main reason why you should always use a virtual environment for your Python projects?

One of your projects might require a different version of an external library than another one. If you have only one place to install packages, then you can't work with two different versions of the same library. This is one of the most common reasons for the recommendation to use a Python virtual environment.

Should I use virtualenv or VENV?

If you need the additional features that virtualenv provides over venv, then you obviously should use virtualenv. If you're satisfied with your current setup with venv, then there's no reason to choose virtualenv.


1 Answers

I would do it that way if you ever think you'll run more than one project on the webserver. As soon as you have two projects you run the risk of a future upgrade of any python package breaking the other site.

like image 173
Kurt Avatar answered Sep 21 '22 17:09

Kurt