# Python : Django : CLI #### Creating Projects & Apps ```bash $ django-admin startproject PROJECT $ manage.py startapp APP ``` #### Managing Projects ```bash $ manage.py # list all commands $ manage.py help COMMAND # Introspection $ manage.py version $ manage.py check $ manage.py diffsettings # Shells $ manage.py shell [--interface ipython] $ manage.py dbshell # Run $ manage.py runserver $ manage.py test [--failfast] [--keepdb] [--debug-mode] sets DEBUG=True [--debug-sql] SQL logging for failing tests (or all tests if --verbosity 2) # Database $ manage.py flush dump DB data (except migrations table) $ manage.py dumpdata $ manage.py loaddata # Database — Migrations $ manage.py makemigrations APP generates migration based on changes to models [--check] exit with non-zero if migrations need to be created [--dry-run] [--empty] [--name NAME] override autogenerated migration name [--no-header] skip Django version & timestamp headers $ manage.py migrate [APP [MIGRATION]] MIGRATON can also be "zero" or a valid migration prefix (like "0001") [--check] exit with non-zero if migrations need to be run [--plan] show operations that will be performed $ manage.py showmigrations $ manage.py sqlmigrate APP MIGRATION show SQL for migration # Users $ manage.py createsuperuser $ manage.py changepassword USERNAME # Common Options --settings MODULE or else checks DJANGO_SETTINGS_MODULE env var --verbosity 0-3 0 = no output, 1 = default, 2 = verbose, 3 = very verbose ignored by `runserver` ```