1. Virtual Environment(가상 환경)
conda create -n westagram python=3.9
conda env list
conda activate westagram
2.. 프로젝트 초기 설정
2-1.. Database 생성(mysql)
mysql -u root -p
mysql> CREATE DATABASE westagram CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
2-2.. Project initial setting
(1) Project Repository Clone
git clone "위에서 복사한 github 주소" .
git clone "위에서 복사한 github 주소"
(2) Project Python Package 설치
$ pip install django
$ pip install mysqlclient
$ pip install django-cors-headers
$ pip install ipython
$ pip install django-extensions
$ pip install httpie
(3) Django Project 설정
** Branch 생성 및 이동 **
$ git checkout -b feature/jaeseung-initial-setting
** Django Project 생성 **
django-admin startproject westagram
cd westagram
suntae
├── manage.py
└── westagram
├── __init__.py
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
** 초기 개발환경(settings.py) 설정 **
1. IP 허용
2. 주석처리(admin, csrf, auth)
3. project/urls.py 수정
4. mysettings.py(DATABASES, SECRET_KEY)
5. requirement.txt 생성 *****************(중요!!!!)
touch requirements.txt
vi requirements.txt
Django==3.2.4
django-cors-headers==3.7.0
mysqlclient==2.0.3
6. .gitignore 생성
touch .gitignore
vi .gitignore
my_settings.py
7. 프로젝트 서버 실행
<<최종 초기 프로젝트 구조>>
├── .gitignore
├── manage.py
├── my_settings.py
├── requirements.txt
└── westagram
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
<<서버 동작(Runserver)을 통한 오류 검증>>
python manage.py runserver
3.. Github Pull Request 생성
- 모든 작업은 절대로
main
브랜치에서 하면 안된다!!!!!!!!
main
을 기준으로 작업할 브랜치를 생성해서 작업하고,
작업 완료 후 해당 브랜치를 푸쉬하여 최종적으로 merge되면
최신화된 main(in Remote)
브랜치를 pull을 통해서 main(in Local)
로 받아오는 방식으로 진행된다.
git checkout feature/jaeseung-initial-setting(작업한 브랜치 이름)
git status
git add .
git commit -m "project initial setting"
git push origin feature/jaeseung-initial-setting
- 위 과정을 거친 후, github repository에서
compare & pull request(PR)
를 진행