Django 에러 sqlite3 db.sqlite3 CategoryInfo : ObjectNotFound: (sqlite3:String) [], CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException

hyereen·2021년 7월 25일
1

장고로 웹 개발 중, migrate로 생성된 DB를 커맨드에서 바로 확인하고 싶을 때, 아래와 같은 명령어를 통해 가능하다.

sqlite3 db.sqlite3

(fcdjango_venv) PS C:\django_project\fc_community> sqlite3 db.sqlite3
sqlite3 : 'sqlite3' 용어가 cmdlet, 함수, 스크립트 파일 또는 실행할 수 있는 프로그램 이름으로 인식되지 않습니다. 이름이 정확한  
지 확인하고 경로가 포함된 경우 경로가 올바른지 검증한 다음 다시 시도하십시오.
위치 줄:1 문자:1
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (sqlite3:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

그러나 이런 오류가 계속 났다.

해결 방법

  1. sqlite3 설치, PATH 추가
    출처: https://stackoverflow.com/questions/37287972/commanderror-you-appear-not-to-have-the-sqlite3-program-installed-or-on-your/56494866

  2. 경로 지정
    출처: https://stackoverflow.com/questions/25962294/windows-powershell-cannot-recognize-sqlite3

이후 다시 커맨드를 입력하면 생성된 테이블들을 확인할 수 있다.

(fcdjango_venv) PS C:\django_project\fc_community> $env:PATH += ';C:\sqlite'
>> & sqlite3.exe
SQLite version 3.34.0 2020-12-01 16:14:00
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
(fcdjango_venv) PS C:\django_project\fc_community> sqlite3 db.sqlite3
SQLite version 3.34.0 2020-12-01 16:14:00
Enter ".help" for usage hints.
sqlite> .tables
auth_group                  django_admin_log
auth_group_permissions      django_content_type       
auth_permission             django_migrations
auth_user                   django_session
auth_user_groups            fastcampus_fcuser
auth_user_user_permissions  fcuser_fcuser
board_board
sqlite> .schema fastcampus_fcuser
CREATE TABLE IF NOT EXISTS "fastcampus_fcuser" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "username" varchar(64) NOT NULL, "password" varchar(64) NOT NULL, "registered_dttm" datetime NOT NULL);
sqlite> 
profile
안녕하세요. 피드백은 언제나 감사합니다.

0개의 댓글