run django on the command line code example
Example 1: python django shell command
$ python manage.py shell
...
>>> execfile('myscript.py')
Example 2: django run management command from code
from django.core.management import call_command
call_command('my_command', 'foo', bar='baz')