How can I setup a consistent python/django/virtualenv environment on my localhost, using my production settings?
On my production server I have python 2.5.2 and django 1.1 installed in a virtualenv directory. I use pip as well. My production server runs on Debian.
On my local pc I run ubuntu and I'd like to have consistent packaging. I have wanted to play with fabric so I now want to setup the same exact environment locally.
I don't have django installed locally, and I have a system wide Python 2.6.5. Can anyone offer advice as to what I need to do in order to reproduce the environment locally? I have generated a requirements.txt file on the production server, which now consists开发者_如何学C of:
1 Django==1.2.1
2 distribute==0.6.10
3 wsgiref==0.1.2
4 yolk==0.4.1
How can I use this locally? And how can I setup the same python version in a virtualenv locally?
Create a virtual instance mimicing your production environment. This will enable you to have a sandbox setup exactly like your production environment. Try VirtualBox :-)
zc.buildout is a good tool for this, but it's not useful "after the fact". But for future projects you might want to consider using it. You then make a configuration file that builds the environment. You can then replicate it by just checking out the configuration file and running a couple of scripts.
I wouldn't be caught without it.
But, it won't exactly help you now. I hope the answer still might be helpful in the future though.
精彩评论