본문 바로가기
BE/Python & Django REST API

[Django REST API] 3. Setting up project

by 건빵거늬 2021. 12. 16.

1. workspace 만들기

생략

2. Git project 만들기

git init

(1) readme.md 만들기

github markdown cheatsheet

https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

 

GitHub - adam-p/markdown-here: Google Chrome, Firefox, and Thunderbird extension that lets you write email in Markdown and rende

Google Chrome, Firefox, and Thunderbird extension that lets you write email in Markdown and render it before sending. - GitHub - adam-p/markdown-here: Google Chrome, Firefox, and Thunderbird extens...

github.com

(2) .gitingnore 만들기

python, vagrant 프로젝트를 위한 standard gitignore 파일

https://gist.github.com/LondonAppDev/dd166e24f69db4404102161df02a63ff

 

Python .gitignore

Python .gitignore. GitHub Gist: instantly share code, notes, and snippets.

gist.github.com

(3) LICENSE 만들기

mit license

https://choosealicense.com/licenses/mit/

 

MIT License

A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

choosealicense.com

3. GitHub push 하기

(1) public/private key 만들기

<1>ssh directory에 key 있는 지 확인하기

ssh directory는시스템의 public/private key가 저장되는 곳이다. 맥을쓰거나, git bash로 windows를 쓰고 있다면 ~/.ssh로 접근가능하다.

 

wsl로 접근 시 없는 디렉토리로 나온다
git bash로 접근시 잘 나온다.

<2> key 만들기

-t rsa: rsa type으로 key를 만듦

-b 4096: 파일크기는 496byte

-C "keon@ubnocto.com": 이 키의 코멘트

 

(/c/Users/82019/.ssh/id_rsa): 키가 저장되는 기본적인 폴더

passphrase: 보안을 높이기 위해 하나의 보안 layer를 쌓는 것이지. 실습에선 생략

 

<3> 생성된 key 확인

id_rsa: private key. 나만 볼 것!

id_rsa.pub: public key. authenticate를 위해 깃허브에 업로드 해도 됨.

 

(2) github에 key등록

1. cat으로 public키 내용 읽어서
2. 복붙하고
3. 잘 등록되었는지 확인

(3) repository 생성(생략)

(4) push

git remote add origin ~ : remote repository를 origin 이라는 이름으로 등록

git branch -M main: 현재 브랜치 이름을 main으로 변경

git push -u origin main: origin remote repository에 main branch를 푸쉬하고, -u를 통해 앞으로 main branch의 푸쉬는 따로 말하지 않아도 전부 origin으로 upstream한다고 설정해줌.

댓글