Ask Your Question

deployment: multiple environments - development, test, production

asked 2012-04-08 08:12:42 -0600

zaf's avatar

I have deployed (in Webfaction) a development environment for askbot in which I commit everyday's updates from both askbot's repo and few local environments. I want now to create two more environments, a testing one and of course the production one. The three environments will have different source code and different databases, running in the same server in domains like, and

I would do this easily for the other 2 environments by following the same instructions but I see that in lib/python2.6 there is a askbot-0.7.40-py2.6.egg folder, so I was wondering that if I install another 2 instances they will override the same folder.

Is this true? How can I prevent this, in order to install three separate environments.

Thanks a lot

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-04-21 11:00:45 -0600

zaf's avatar

The solution for this is just to use virtual environments, so that each one is isolated from the others. To do this, there is a tool virtualenv, easily installed by easy_install virtualenv, and even more easily used by virtualenv <projectNameDir>. This way, nothing is stored on the common site-packages, and files under <projectNameDir> have their own site-packages and are isolated, so you can have many environments in the same server.

Note: When you are inside <projectNameDir> and you run your commands like 'python ...' make sure to use python (and any other tools) found at bin folder of your virtual environment. So you will end up running commands like

../bin/python syncdb


edit flag offensive delete link more



You can also activate the virtual environment and then just use "python" command, without the path: source path_to_env/bin/activate.

Evgeny's avatar Evgeny  ( 2012-04-21 12:34:01 -0600 )edit

Nice @Evgeny, thanks. And how do I change from environment to environment. I mean, I have multiple environments and there is a folder bin in all of them. Should I run this activate command everytime I want to work on another environment?

zaf's avatar zaf  ( 2012-04-21 12:40:08 -0600 )edit

You can type deactivate too, but there is a tool called virtualenvwrapper that helps switching the environments, I don't really use it though because I don't have a need to switch very often.

Evgeny's avatar Evgeny  ( 2012-04-21 12:45:23 -0600 )edit

Forgot to mention, my installation did not work, till I changed my django.wsgi file so that sys.path includes also the lib/python2.6 directory of my virtual env. Why should I have done this manually? Did I set up anything wrong? Anyway, now its working!

zaf's avatar zaf  ( 2012-04-21 14:34:24 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-04-08 08:12:42 -0600

Seen: 505 times

Last updated: Apr 21 '12