Django Management Commands Builtin Management Commands

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Django comes with a number of builtin management commands, using python manage.py [command] or, when manage.py has +x (executable) rights simply ./manage.py [command] . The following are some of the most frequently used:

Get a list of all available commands

./manage.py help

Run your Django server on localhost:8000; essential for local testing

./manage.py runserver

Run a python (or ipython if installed) console with the Django settings of your project preloaded (attempting to access parts of your project in a python terminal without doing this will fail).

./manage.py shell

Create a new database migration file based on the changes you have made to your models. See Migrations

./manage.py makemigrations

Apply any unapplied migrations to the current database.

./manage.py migrate

Run your project's test suite. See Unit Testing

./manage.py test

Take all of the static files of your project and puts them in the folder specified in STATIC_ROOT so they can be served in production.

./manage.py collectstatic

Allow to create superuser.

./manage.py createsuperuser

Change the password of a specified user.

./manage.py changepassword username

Full list of available commands



Got any Django Question?