I'm planning to set up a Python app (Pyblosxom) on my server and considering to run it in its own virtualenv sandbox with --no-site-packages. I'm hoping that such a setup would be easily portable and maintainable over the years.

However, I've only used virtualenv for development environments that recreate a certain server setup locally, and most sources about virtualenv seem to also mention virtualenv for such a use.

Is there any drawback to running a Python app from a virtualenv on a live server?

NOTE: As for the portability of the setup, I've just been made aware of the experimental --relocatable option which needs to be ran after new package installs. Even if I didn't do this though, I guess the setup would be quite portable thanks to pip.


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.

However, I wouldn't recommend using it for "portability" -- trying to transport the whole thing from machine to machine. There's far too much opportunity for subtle failures due to incompatibilities nobody else is going to notice (because it's not something that's widely done). Instead, have automation which is capable of setting up a new virtualenv matching your requirements on a new machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.