This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Deployment tools for django projects

Project Description

Management command to automate deployment of django project using


I used to define set of actions to be run after `git pull` to update my project
environment in various provisioning/deployment tools. However, since most of
these actions were just `` commands and since I've started to use setup
script I wanted to define these actions right there.

What this app does

Run sequence of management commands or any python callable right after project
app is installed or updated. It's intended to be used with setup script, but
can be also run separately.

What this app does not

Restarts http server, database or other services. Although one can define tasks
which does one of these *root tasks*, this app isn't intended to do so. It's
left to other provisioning/deployment tools like Fabric, Salt or Ansible.


1. Install `django-deploy-setup` and add it into your requirements.

2. Add `django_deploy` to your INSTALLED_APPS.

3. Next step depends whether your project uses `` or not:

With ````

Add custom install command to `cmdclass` argument in your

from django_deploy.setup import DjangoInstall as install

cmdclass={'install': install},

`DjangoInstall` will call `deploy` management command after regular install.

*Please note:* `DJANGO_SETTINGS_MODULE` environment variable must be defined
before running `python install` when using `DjangoInstall` command.

### Problem with `install_requires`

This approach has one major flaw. In case you specify your
project requirements using `install_requires` keyword, you won't be able to
import `django_deploy` module during initial install.

One possible solution is add following import statement and install
application twice. Updates will work just fine:

from django_deploy.setup import DjangoInstall as install
except ImportError:
from distutils.command.install import install

Without ````

Simply call ` deploy` after updating codebase and
installing requirements.

Default deployment tasks

By default, `deploy` command will run following commands:

1. `syncdb` (if you're using Django < 1.7)
2. `migrate` (if your're using south or Django > 1.7)
3. `collectstatic` (if you're using `django.contrib.staticfiles`)
4. `compilemessages` (if you're using internationalization, `I18N = True`)

Custom deployment tasks

If you want to run custom deployment tasks, create `` file somewhere
in your project directory and set `DEPLOY_TASKS` in settings as dotted path:

DEPLOY_TASKS = 'project_name.deploy`

Next, create variable `tasks` as a list of `Task` instances:

# project_name/

tasks = (
Task('syncdb', interactive=False),
Task('collectstatic', interactive=False),

Task definition

To define task simply pass command_name, args and kwargs as you would for

Task('syncdb', interactive=False)

is the same as:

call_command('syncdb', interactive=False)

The difference is, that command defined via `Task` is executed using
`run` method.

Custom callable

If you want to use custom callable instead of default ``call_command``, pass
``custom_callable`` keyword argument:

Task(custom_callable=my_command, kwarg=42)


Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-deploy-setup-0.1.1a.tar.gz (4.6 kB) Copy SHA256 Checksum SHA256 Source May 7, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting