본문 바로가기

Django

Django sqlite3 기초

반응형

 

이미지 썸네일 삭제
Writing your first Django app, part 2 | Django documentation | Django

Writing your first Django app, part 2 ¶ This tutorial begins where Tutorial 1 left off. We’ll set up the database, create your first model, and get a quick introduction to Django’s automatically-generated admin site. Where to get help: If you’re having trouble going through this tutorial, please hea...

docs.djangoproject.com

1. 기본 설치되는 sqlite3의 shell에 입장하기

$ python manage.py dbshell
 

2. 존재하는 table 확인하기

$ python manage.py dbshell
SQLite version 3.36.0 2021-06-18 18:58:49
Enter ".help" for usage hints.
sqlite> .tables
auth_group                  auth_user_user_permissions
auth_group_permissions      django_admin_log          
auth_permission             django_content_type       
auth_user                   django_migrations         
auth_user_groups            django_session       
 
 

3. DB shell 빠져나오기

sqlite> .quit
 

4. DB Schema Migration 하기

$ python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  No migrations to apply.
 

 

 

반응형