Django Admin Commands
which I thought were called management commands, but not so, according to the Django documentation which I trust. But don't look at that yet! Because I'm about to tell you how to do it right now.
It's like Rails rake tasks!
create a file/ the necessary folders inside your project like this:
app/management/commands/name_of_command.py
In the file put this:
from django.core.management.base import BaseCommand, CommandError from app.models import Model_That_You_Need class Command(BaseCommand): help = “Description of what the command does” def handle(self, param1, param2): # all the code you want to run when you call this command
Then run the command from your project directory in your terminal:
./manage.py name_of_command
Ok, now you can do look at the Django documentation. It really is quite good.










