Creating custom management command

Place it in management/commands


The simplest command:

from import BaseCommand

class Command(BaseCommand):
    help = 'Example command'

    def handle(self, *args, **options):
        print 'Command example'

To see commands that may be used with

Just run it and it will output the list.

For instance, if you do not remember how to create an admin it will show that it may be created with

./ createsuperuser

Run initial database migration with South when database already exists

./ migrate myapp --fake
Last edited by Artem Dudarev, 2013-10-13 02:01:37. Edit