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)
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With