DjangoManagement Commands


Introduction

Management commands are powerful and flexible scripts that can perform actions on your Django project or the underlying database. In addition to various default commands, it's possible to write your own!

Compared to regular Python scripts, using the management command framework means that some tedious setup work is automatically done for you behind the scenes.

Remarks

Management commands can be called either from:

  • django-admin <command> [options]
  • python -m django <command> [options]
  • python manage.py <command> [options]
  • ./manage.py <command> [options] if manage.py has execution permissions (chmod +x manage.py)

To use management commands with Cron:

*/10 * * * * pythonuser /var/www/dev/env/bin/python /var/www/dev/manage.py <command> [options] > /dev/null