[Solved]-Does Django have an equivalent of Rails's "bundle install"?

14👍

You can freeze requirements. This generates a list of all the Python modules that your project needs. I believe bundle is similar in concept.

For example:

virtualenv --no-site-packages myproject_env # create a blank Python virtual environment
source myproject_env/bin/activate # activate it
(myproject_env)$ pip install django # install django into the virtual environment
(myproject_env)$ pip install other_package # etc.
...
(myproject_env)$ pip freeze > requirements.txt

The last line generates a text file will all the packages that were installed in your custom environment. You can use that file to install the same requirements on other servers:

pip install -r requirements.txt

Of course you don’t need to use pip, you can create the requirements file by hand; it doesn’t have any special syntax requirements. Just a package and (possibly) version identifier on each line. Here is a sample of a typical django project with some extra packages:

Django==1.4
South==0.7.4
Werkzeug==0.8.3
amqplib==1.0.2
anyjson==0.3.1
celery==2.5.1
django-celery==2.5.1
django-debug-toolbar==0.9.4
django-extensions==0.8
django-guardian==1.0.4
django-picklefield==0.2.0
kombu==2.1.4
psycopg2==2.4.5
python-dateutil==2.1
six==1.1.0
wsgiref==0.1.2
xlwt==0.7.3

4👍

The closest is probably virtualenv, pip and a requirements file.
With those 3 ingredients is quite easy to write a simple bootstrap scripts.

More demanding and complex is buildout. But I would only go for it if virtualenv and pip are not sufficient.

And if you extend this approach with fabric and optional cuisine, you already have your project deployment automated. Check out these links for more information:

Leave a comment