Skip to main content

App for monitoring management commands on Django.

Project description


.. image::
:alt: Build Status
.. image::
:alt: Code Health
.. image::,2.7,3.4,3.5,pypy,pypy3-blue.svg
:alt: Python 2.6, 2.7, 3.4
.. image::
:alt: Current version on PyPi
.. image::
:alt: Downloads from PyPi
.. image::
:alt: License

What's that
App for monitoring management commands on Django.

Quick installation
1. Using pip:

.. code-block:: bash

$ pip install django-mmc

2. Add ``mmc`` application to ``INSTALLED_APPS`` in your settings file

3. Inject management classes before apps will be loaded

.. code-block:: python

from mmc.mixins import inject_management


4. Sync database (``./ syncdb`` or ``./ migrate``)

5. Enjoy

Demo installation


.. code-block:: bash

$ git clone --depth 1 -b master mmc
$ cd mmc
$ docker build -t mmc .
$ docker run -it -d -p 8000:8000 --name mmc mmc
$ docker exec -i -t mmc /bin/bash
$ cd /mmc_demo/


.. code-block:: bash

$ git clone --depth 1 -b master mmc
$ cd mmc
$ vagrant up --provider virtualbox
$ vagrant ssh
$ cd /mmc_demo/

**OS X/Linux**

.. code-block:: bash

$ sudo apt-get install -y virtualenvwrapper || brew install pyenv-virtualenvwrapper
$ source /usr/share/virtualenvwrapper/ || source /usr/local/bin/
$ mkvirtualenv django-mmc
$ git clone --depth 1
$ cd django-mmc
$ python develop
$ cd demo
$ pip install -r ../requirements/dev.txt
$ python syncdb --noinput
$ python createsuperuser --username admin --email
$ python test_command >& /dev/null
$ python test_command_noargs >& /dev/null
$ python test_command_error >& /dev/null
$ python test_command_killed >& /dev/null
$ python runserver >& /dev/null &

Open app in browser (login and password is admin/admin):

.. code-block:: bash

$ xdg-open >& /dev/null || open >& /dev/null


1. Execute the command, and script will be available at
2. Configure script options on script settings
3. Add email addresses for errors notification
4. All logs available on Logs page
5. If you are using sentry, configure sentry, and all errors will be send into sentry too

Usage without inject

If you want track only specified commands manually without auto-inject,
follow to examples below:

.. code-block:: python

# args
from mmc.mixins import BaseCommand

class Command(BaseCommand):
def handle(self, *args, **options):
print "OK"

# noargs
from mmc.mixins import NoArgsCommand

class Command(NoArgsCommand):
def handle_noargs(self, *args, **options):
print "OK"

When you are using auto-inject, you can use ignore flag on Scripts/Hosts settings.
Logs about execution not be stored, but if you got any error on your commands,
you will be notified to emails.

Cron debug
For debug any messages or some errors on app, run commands with example below:

.. code-block:: bash


# Project commands
50 2 * * * $PYTHON_BIN $MANAGE_PY clean >> $LOG_FILE 2>&1

Multi-instance lock

If you are using "One copy" functionality, and command is run on multiple
servers, you can use Memcached/Redis lock. Just configure it on

.. code-block:: python

MMC_LOCK_TYPE = 'MemcacheLock'

'servers': [''], 'debug': 0

Management commands
``mmc_cleanup`` - clean logs by days/date

``mmc_notify`` - notify users, when script is killed by OS (that actual for long tasks and for big databases).
For detailed check (by pid and name) you can install ``psutil``.

Sentry support
If you want receive notifications and detailed traceback to Sentry,
you can install ``raven``, and configure project dsn settings.

* `Установка и использование с примерами на русском <>`_.
* `Completely installation and usage with examples. Translated by Google <>`_.

.. image:: /screenshots/log_changelist.jpg
.. image:: /screenshots/log_edit.jpg
.. image:: /screenshots/script_changelist.jpg
.. image:: /screenshots/script_edit.jpg
.. image:: /screenshots/email_changelist.jpg
.. image:: /screenshots/email_edit.jpg
.. image:: /screenshots/hosts_changelist.jpg

* Python: 2.6, 2.7, 3.4, 3.5, pypy, pypy3
* Django: 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9

Project details

Download files

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

Source Distribution

django-mmc-1.6.5.tar.gz (30.9 kB view hashes)

Uploaded source

Built Distribution

django_mmc-1.6.5-py2.py3-none-any.whl (57.6 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page