All Projects → mrts → Django Commands

mrts / Django Commands

Licence: mit
Management commands for Django: clear database, backup database, load database from backup, clear cache.

Programming Languages

python
139335 projects - #7 most used programming language

django-commands

django-commands contains the following command extensions for the Django web framework:

  • db_clear -- removes all tables from the database,
  • db_backup -- creates a backup dump file of the database,
  • db_load -- loads data from a backup dump file to the database,
  • app_db_tables_reset -- deletes all data related to the given app from the database,
  • cache_clear -- calls clear_from_cache() for all objects in given models.

Only app_db_tables_reset has been tested with Django 1.9, other commands may or may not work.

Installation

Install the package with pip::

$ pip install git+http://github.com/mrts/django-commands.git

and add 'django_commands' to INSTALLED_APPS in your Django project settings file::

INSTALLED_APPS = ( ... 'django_commands', )

Invoke ./manage.py help to verify that the commands are available and ./manage.py help commandname for more specific usage instructions.

Intended use

The commands have been created for automating remote deployments with Fabric_.

See example fabfile_ and project setup guidelines_.

The workflow would be as follows:

  • add a feature or fix a bug on git branch devel

  • deploy to remote staging server::

    fab -H [email protected]:port deploy:stage

  • when client is happy with the change, merge it to master

  • deploy to remote production server::

    fab -H [email protected]:port deploy:live

  • fetch database content and uploaded files from remote server as needed::

    fab -H [email protected]:port fetch_data:live

.. _Fabric: http://fabfile.org .. _example fabfile: http://gist.github.com/768913 .. _project setup guidelines: http://github.com/mrts/django-commands/wiki/Proper-setup-of-a-Django-project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].