What is the best practice for deploying (dependency management) applications for reusing django in a real production project?

In our project, we use some applications for reusing django, we consider how to make continuous and automatic deployment simple and painless.

We have 2 options:

option # 1: use "pip install xxx" to install all dependent dependency applications. Write a script to install and check for dependencies.

option # 2: make a copy of all reusable applications in our own directory, so we basically expand everything in our project directory.

Both options have their pros and cons, I wonder if you can share your best practice in this?

+7
source share
2 answers

You can easily create a dependency file with pip, which will mean that the correct versions of each application will be supported between servers

# Save dependancies to a file pip freeze > requirement_file.txt 

creates a file like this:

 django==1.3 django-tagging markdown ... 

which can later be used to reinstall the listed applications on another server

 # Install all dependancies in the file pip install -r requirement_file.txt 

This is a good and easy approach. You may get complicated with the like zc.buildout

http://pypi.python.org/pypi/zc.buildout

which helps to manage packages (python and non-python) with scripts (you create β€œrecipes” containing the package details that you need)

If you need more control over server settings, you can use a "puppet" or a "chef"

http://projects.puppetlabs.com/projects/1/wiki/Big_Picture http://wiki.opscode.com/display/chef/Chef+Server

which focus on automation and deployment more than just dependencies, but entire servers

I did not need to use simpler icon requirements files, but other options are great if you need more.

EDIT

Saving your own version of applications in your project root / root path can become complicated and difficult to track, I would suggest using the protocol requirements file.

+13
source

I found it on the django website:

https://code.djangoproject.com/wiki/best-practices-to-work-with-3rd-party-apps-and-making-yours-portable

It looks like he offers what I listed in doubt as option number 2.

0
source

All Articles