Django Command Reference 정리

프로젝트 관리

Django 프로젝트와 앱을 생성 및 관리하는 명령어.

  • django-admin startproject <프로젝트_이름>
  • python manage.py startapp <앱_이름>

개발 서버

개발 서버를 실행하고 관리하는 명령어.

  • python manage.py runserver [주소:포트]
  • python manage.py runserver_plus [주소:포트] (django-extensions 필요)

데이터베이스 마이그레이션

데이터베이스 스키마 변경을 처리하는 명령어.

  • python manage.py makemigrations [앱_라벨]
  • python manage.py migrate [앱_라벨] [마이그레이션_이름]
  • python manage.py showmigrations [앱_라벨]

데이터베이스 작업

고급 데이터베이스 상호작용을 위한 명령어.

  • python manage.py sqlmigrate <앱_라벨> <마이그레이션_이름>
  • python manage.py sqlsequencereset <앱_라벨>
  • python manage.py dbshell

슈퍼유저 관리

슈퍼유저를 생성하고 관리하는 명령어.

  • python manage.py createsuperuser
  • python manage.py changepassword <사용자_이름>

쉘 및 인터랙티브 환경

Django 쉘과 상호작용하는 명령어.

  • python manage.py shell
  • python manage.py shell_plus (django-extensions 필요)

정적 파일

정적 파일을 관리하는 명령어.

  • python manage.py collectstatic
  • python manage.py findstatic <경로>

테스트

테스트를 실행하는 명령어.

  • python manage.py test [앱_라벨] [테스트_케이스]

데이터 관리

데이터를 로드하고 덤프하는 명령어.

  • python manage.py loaddata <피처처>
  • python manage.py dumpdata [앱_라벨.모델_이름]

국제화

번역을 처리하는 명령어.

  • python manage.py makemessages -l <언어_코드>
  • python manage.py compilemessages

유틸리티

기타 유용한 명령어.

  • python manage.py check
  • python manage.py flush
  • python manage.py inspectdb
  • python manage.py diffsettings
  • python manage.py showmigrations
  • python manage.py validate

커스텀 명령어

커스텀 관리 명령어를 생성하고 관리하는 명령어.

  • python manage.py <커스텀_명령어>

보안

보안 관련 명령어.

  • python manage.py createsuperuser
  • python manage.py changepassword <사용자_이름>

캐싱

캐시를 관리하는 명령어.

  • python manage.py clear_cache

확장 (옵션)

서드파티 패키지에서 제공하는 명령어.

  • python manage.py runserver_plus (django-extensions)
  • python manage.py graph_models (django-extensions)
  • python manage.py crispy_forms (django-crispy-forms)