다음과 같이 설정이 되어있을때는 ['localhost', '127.0.0.1', '[::1]'] 에 대해서 유효하다.
INSTALLED_APPS
django.contrib.admin : 관리용 사이트
django.contrib.auth : 인증 시스템
django.contrib.contenttypes : 컨텐츠 타입을 위한 프레임 워크
django.contrib.sessions : 세션 프레임워크
django.contrib.messages : messaging 프레임워크
django.contrib.staticfiles : 정적파일을 관리하는 프레임워크
데이터베이스
migration
migrate 명령은 settings.py 의 INSTALLED_APPS 설정을 탐색하여, 데이터베이스 migrations에 따라 필요한 데이터베이스 테이블을 생성한다.
migrate하기 전에 불필요한 애플리케이션(INSTALLED_APPS)은 주석처리 또는 삭제해주면 생성되지않는다.
ModuleNotFoundError
```python .... File "/Users/jeongdaye/.pyenv/versions/3.7.2/lib/python3.7/sqlite3/dbapi2.py", line 27, in from _sqlite3 import * ModuleNotFoundError: No module named '_sqlite3' ```
Migrate 실행시 다음과 같은 오류가 발생할 수 있다. 이러한 경우에는
자기가 설정한 python version으로 다음 명령어를 실행해주면 된다.
git 버전 관리
git으로 버전 관리시 git으로 관리되지 않을 파일 목록인 .gitignore 파일을 생성해 관리한다. 일반적으로 Django 프로젝트에서 사용하는 파일을 wget으로 사용해 웹에서 복사해와 사용할 것이다.
project
├── project_name
│ ├── config # 장고프로젝트 설정 패키지
│ │ ├── __init__.py
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── db.sqlite3
│ └── manage.py
└── requirements.txt # 설치할 pip 패키지 목록 파일
$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
March 05, 2019 - 16:21:39
Django version 2.1.7, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying sessions.0001_initial... OK