django how to run a management command within python not from cli code example
Example: python django shell command
$ python manage.py shell
...
>>> execfile('myscript.py')
$ python manage.py shell
...
>>> execfile('myscript.py')