Django development environment replication / replication

I work with friends in a Django project. The project has dependencies on some python modules. I have django and these additional dependencies installed inside virtualenv. The django project code is located in the repository, accessible to all friends who can check / clone, and then add the code to it. But is there a way to replicate the settings that I have in my development environment on my friends' computers, that is, something that will install all the additional dependencies and prepare the environment for deployment?

I heard about zc.buildout. Just looked at him without going too deep. It seems complicated. Are there other ways to achieve this? The development environment used by my friends varies from GNU / Linux to MS Windows.

+3
source share
2 answers

buildout.cfg:

[buildout] parts = python [python] recipe = zc.recipe.egg eggs = your egg dependencies here interpreter = python 

Get bootstrap.py . Then:

 $ python bootstrap.py $ bin/buildout $ bin/python ... 
+3
source

virtualenv has a neat feature in which it creates a copy of itself with a few more hooks. In your case, hook_ after_install is important, which will be launched immediately after virtualenv installation.

Just create a script with the following contents:

 import os, virtualenv extra_text = """ import os, subprocess def after_install(options, home_dir): subprocess.call([ os.path.join(home_dir, 'bin', 'pip'), 'install', '-r', 'relative_path_from_env_home_to_requirements_file', ]) def adjust_options(options, args): if not args: args.append('.') """ output = virtualenv.create_bootstrap_script(extra_text) open('bootstrap.py', 'w').write(output) 

And do it. He will create a bootstrap.py file that your colleague must execute in order to download both the virtual file and the necessary packages:

 ./bootstrap.py --no-site-packages 

Virtualenv is created at the root of the project, so before committing, make sure that svn: ignore or .gitignore are created by dirs.

The only drawback to this is that AFAIK is not integrated with virtualenvwrapper. But in any case, the point is to have an environment in the project, and one of virtualenvwrapper is to have an environment in your homedir.

+3
source

All Articles