133👍
You generate a “requirements” file (usually requirements.txt
) that you commit with your project:
pip freeze > requirements.txt
Then, each developer will set up their own virtualenv and run:
pip install -r requirements.txt
8👍
All these environment hassles are kind of common when you are doing python/django development! I went through all these problem, and I have tested some solutions! Things that I have tested:
- Project running local
- Project running in virtualenv
- Project running in a VM
- Project running in a VM, using vagrant
The best solution I found was #4! because the company that I used to work, each person in the team has a different OS, all sort of windows, mac and linux, and to install all dependencies for each environment it takes time! So we decided to try virtualenv, which is really good! but still each person has to setup his own enviroument. The problem in virtualenv is that all python sources are within the environment that u create! So I would not push those files to a source version control!
Best solution was #4, because that was exactly what I needed, Vagrant uses Chef to setup your environment, so you just have to write some recipes, and let vagrant run them for u! Then u push those recipes to SCM, then when the next person get the files from SCM and reloads the VM all dependencies will be automatically install!
I have a blog post explaining more about the subject as well as I have created a Django Blank project in github so you can get that to have a start point of your project using vagrant.
http://arthurnn.com/blog/2011/11/25/easy-django-quickstart/ (link no longer active, so linked to Wayback Machine)
EDIT
Solution from Chris Pratt is a good one as well, however some libraries are not so straightforward to install in all OS, for instance, a lot people on Mac get problems when they want to install MySQLdb-python. which is a really common library, but if everyone in your team has to spend time solving this issues, is not good at all!
- [Django]-How to test "render to template" functions in django? (TDD)
- [Django]-How to mix queryset results?
- [Django]-Django admin ManyToMany inline "has no ForeignKey to" error