Django

[Django] Project, Application 생성

_주야 2022. 3. 18. 23:20

 

Django Project 생성                                           

-Project (myProject01) 생성 및 구조 확인

# django-admin startproject myProject                                                                     
# cd myProject                                                                                       
# tree                                                                                                  
.                                                                                                        
├── manage.py                                                                                              
└── myProject                                                                                    
    ├── __init__.py                                                                                          
    ├── settings.py                                                                                         
    ├── urls.py                                                                                              
    └── wsgi.py

                   

Django Application 생성

-Appliation (myApp01) 생성 및 구조 확인

# python manage.py startapp myApp01                                                                   
# cd myApp01                                                                                       
# tree                                                                                                  
.                                                                                                        
├── __init__.py                                                                                    
├── admin.py                                                                                     
├── apps.py                                                                                       
├── migrations                                                                                              
│   └── __init__.py                                                                                         
├── models.py                                                                                    
├── tests.py                                                                                       
└── views.py   

 

주요 명령어 및 환경 설정 파일                                                       
manage.py : 프로젝트 관리 명령어 (./manage.py –-help)                                    
- startapp : application 생성                                                                       
-runserver : 서버 실행                                                                              
-createsuperuser :  관리자 생성                                                                  
-makemigrations app : applicatio의 모델 변경사항 확인                                                 
-migrate : 변경 사항을 DB에 반영                                                                
-shell : 쉘을 통해 데이터 확인                                                                     

settings.py : Project 환경 설정 파일                                                            
-DEBUG :  디버그 모드로 실행                                                                    
-INSTALLED_APPS :  pip로 설치하거나 사용자가 만든 Application 설정                                         
-MIDDELWARE_CLASSES : reques와 response 사이의 주요 기능 레이어                                         
-TEMPLATES : django template 관련 설정                                                       
-DATABASE : 데이터베이스 엔진의 연결 설정                                                              
-STATIC_URL : 정적 파일의 URL(css, javascript, image …) 

 

 

'Django' 카테고리의 다른 글

[Django] 설정  (0) 2022.03.18
[Django] Database 설정  (0) 2022.03.18
[Django] install  (0) 2022.03.18
[Django] 소개  (0) 2022.03.18
[Django] Python 웹 프로그래밍 Django 설치  (0) 2022.03.18