Skip to main content
Help us improve Python packaging – donate today!

Django-docopt-command allows you to write Django manage.py commands using the docopt library

Project Description

Build Status

Django-docopt-command allows you to write Django manage.py commands using the docopt library. This means that you can define commands using usage strings.

References:

class Command(DocOptCommand):
    # This usage string defines the command options:
    docs = "Usage: command <option1> <option2> [--flag1]"

    def handle_docopt(self, arguments):
        # arguments contains a dictionary with the options
        pass

Django-docopt-command is tested with Django 1.4-1.7 and Python 2.6, 2.7, 3.3 and 3.4 and is hosted on github.

Example

See the testproject/docopt_example in the django-docopt-command github repository.

Usage

Install django-docopt-command.

pip install django-docopt-command

Step 1 - management command

Write a Django custom management command, as described in Writing custom django-admin commands.

Step 2 - inherit from DocOptCommand

class Command(DocOptCommand):
    pass

Step 3 - add a docs string

class Command(DocOptCommand):
    docs = "Usage: command <option1> <option2> [--flag1]"

Step 4 - override handle_docopt

class Command(DocOptCommand):
    docs = "Usage: command <option1> <option2> [--flag1]"

    def handle_docopt(self, arguments):
        pass

License

Django-docopt-command is licensed under the Apache 2.0 License.

Release history Release notifications

History Node

0.3.0

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

This version
History Node

0.2.0

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django_docopt_command-0.2.0-py2.7.egg (3.9 kB) Copy SHA256 hash SHA256 Egg 2.7 Aug 28, 2014
django_docopt_command-0.2.0-py2-none-any.whl (3.4 kB) Copy SHA256 hash SHA256 Wheel 2.7 Aug 28, 2014
django-docopt-command-0.2.0.tar.gz (2.5 kB) Copy SHA256 hash SHA256 Source None Aug 28, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page