Management commands used in this chapter
In this chapter we have introduced a variety of Django management commands. You need to get familiar with them, as they will be used often throughout the book. Let’s revisit the commands we have covered in this chapter.
To create the file structure for a new Django project named mysite
we have used the following command:
django-admin startproject mysite
To create the file structure for a new Django application named blog
:
python manage.py startapp blog
To apply all database migrations:
python manage.py migrate
To create migrations for the models of the blog
application:
python manage.py makemigrations blog
To view the SQL statements that will be executed with the first migration of the blog
application:
python manage.py sqlmigrate blog 0001
To run the Django development server:
python manage.py runserver
To run the development server specifying host/port and settings file:
python manage.py runserver 127.0.0.1:8001 --settings...