see also: runserver
default to http://127.0.0.1:8000/
python manage.py runserver
specify port
python manage.py runserver 8000
bind interfaces
python manage.py runserver 0:8000
Note
0 is a shortcut for 0.0.0.0.
create new app (in the current dir)
python manage.py startapp <name>
init db / run migrations
python manage.py migrate
create migrations for <app name> app
python manage.py makemigrations <app name>
show migration SQL for <app name> and <migration name>
python manage.py sqlmigrate <app name> <migration name>
Note
model change steps:
- Change your models (in models.py).
- Run python manage.py makemigrations to create migrations for those changes.
- Run python manage.py migrate to apply those changes to the database.
create root user for admin site (/admin)
python manage.py createsuperuser
run python shell
python manage.py shell
run tests for the app <app name>
python manage.py test <app name>
check for any issue in the project
python manage.py check