, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheaders'
ํ๋ก ํธ
โข
Todo: ์ฃผํฌ์ ๋ฐฐํฌ๊ฐ ์๋์ด์๋ค๋ฅผ ๋ณด์ฌ์ค ์์ @์ด์ฃผํฌ
โข
๋ฐฐํฌ๊ฐ url ๋ ๊ฐ
โฆ
develop ๋ธ๋์น- https://mu-go-you-develope.vercel.app
โฆ
main ๋ธ๋์น- https://mu-go-you.vercel.app
ํ๋ก ํธ Github actions
๋ฐฑ์๋ ์ปค๋ฐ ์ปจ๋ฒค์
๋ฐ์ lint check ์งํํ๋ฉด์ $ pre-commit install ์คํ ์ดํ์
$ pre-commit install --hook-type commit-msg ํ๋ฒ ํด์ฃผ์ธ์.
import re
import sys
# ์ปค๋ฐ ๋ฉ์์ง ํ์์ ์ ์ํฉ๋๋ค.
COMMIT_MSG_REGEX = r"^(feat|fix|docs|style|refactor|test|chore):\s.+"
def validate_commit_message(commit_msg_file):
with open(commit_msg_file, "r") as file:
commit_msg = file.read().strip()
if not re.match(COMMIT_MSG_REGEX, commit_msg):
print("Error: Invalid commit message format.")
print("Commit message should start with one of the following types:")
print("feat, fix, docs, style, refactor, test, chore")
print('Example: "feat: add new user login feature"')
sys.exit(1)
if __name__ == "__main__":
validate_commit_message(sys.argv[1])
Python
๋ณต์ฌ
BE CD
โข
AWS
aws ๋ฐฐํฌ: http://43.203.225.31
/auth/register
/auth/login
์๋ ๋ฐฐํฌ ๋ฐฉ๋ฒ
1.
์๋ฒ ์ ์
$ ssh ubuntu@43.203.225.31
2.
ํ๋ก์ ํธ ๋๋ ํ ๋ฆฌ๋ก ์ด๋
$ cd ~/MGU-Yulliy-server
3.
๊น ๋ ํฌ์งํ ๋ฆฌ ์
๋ฐ์ดํธ
$ git pull origin develop
4.
๊ฐ์ํ๊ฒฝ ํ์ฑํ
$ source venv/bin/activate
5.
ํ์ํ ํจํค์ง ์ค์น โ requirements.txt ํ์ผ์ด ์
๋ฐ์ดํธ ๋ ๊ฒฝ์ฐ
$ pip install -r requirements.txt
6.
๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ง์ด๊ทธ๋ ์ด์
์ ์ฉ
7.
์ ์ ํ์ผ ์์ง(ํ์ํ ๊ฒฝ์ฐ๋ง)
8.
gunicorn ์ฌ์์
sudo pkill -f gunicorn โ ๋ฐฑ๊ทธ๋ผ์ด๋์์ ์คํ ์ค์ธ ํ๋ก์ธ์ค ์ข
$ sudo systemctl restart gunicorn
9.
nginx ์ฌ์์
$ sudo systemctl restart nginx
Docker Desktop ๋ค์ด๋ก๋
ubuntu ํ๊ฒฝ์ด๋ผ๋ฉด settings์์ ๋ฐ์ ์ต์
๋ค ํ์ฑํํด์ผ ์ ๋์๊ฐ๋๋น
์๋ฌ
ํจํค์ง ์ค์น
1.
Docker ์ค์น๋ฅผ ์ํ ์์กด์ฑ ํจํค์ง ์ค์น
sudo apt-get install docker-ce docker-ce-cli containerd.io sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
docker-buildx-plugin docker-compose-plugin
JavaScript
๋ณต์ฌ
2.
Docker ๊ณต์ GPG ํค ์ถ๊ฐ
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
JavaScript
๋ณต์ฌ
3.
Docker ์ ์ฅ์ ์ค์
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
JavaScript
๋ณต์ฌ
4.
ํจํค์ง ๋ชฉ๋ก ์
๋ฐ์ดํธ
sudo apt-get update
5.
Docker ํจํค์ง ์ค์น
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
JavaScript
๋ณต์ฌ
sudo docker run hello-world ๋ฅผ ์
๋ ฅํ์ ๋
์ด๋ ๊ฒ ๋จ๋ฉด ๋ฉ๋๋น
Docker Build Image & push
1.
docker login
2.
docker build -t <image_name> .
3.
docker run -d -p 80:8000 <image_name>
4.
docker tag my_local_image your_username/your_repo:latest
5.
docker push your_username/your_repo:latest
ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey]
๋ฐฑ์๋ lint check
์ ์ฉ๋์ด ์๋ ํ
โข
trailing-whitespace : ๋ถํ์ํ ํํ ๊ณต๋ฐฑ ์ ๊ฑฐ
โข
end-of-file-fixer : ํ์ผ ๋์ ๊ฐํ ๋ฌธ์๊ฐ ํฌํจ๋๋๋ก ํจ
โข
check-yaml : yaml ํ์ผ ๋ฌธ๋ฒ ๊ฒ์ฌ
โข
check-added-large-files : ๋๋ฌด ํฐ ํ์ผ์ด ์ปค๋ฐ๋์ง ์๋๋ก ๋ฐฉ์ง
โข
black : ํ์ด์ฌ ์ฝ๋๋ฅผ Black ์คํ์ผ ๊ฐ์ด๋์ ๋ง๊ฒ ์๋์ผ๋ก ํฌ๋งท โ ์๋ ์์
โข
flake8 : ํ์ด์ฌ ์ฝ๋๊ฐ PEP8 ์คํ์ผ ๊ฐ์ด๋๋ฅผ ์ค์ํ๋์ง ๊ฒ์ฌ โ ์๋ ์์
ํฐ๋ฏธ๋์์ ์ปค๋ฐ ์ flake8 ์์ failed โ ์๋ ์์ ํ ๋ค์ add, commit
๋๋จธ์ง์์ failed โ ์๋ ์์ ๋์ผ๋ฏ๋ก ๋ฐ๋ก ๋ค์ add, commit
์ด๊ธฐ ์ค์
# pre-commit ์ค์น
$ pip install pre-commit
# .git/hooks์ pre-commit ํ
์ค์น
$ pre-commit install
# pre-commit ํ
์คํ ํ
์คํธ (๋ชจ๋ ํ์ผ)
$ pre-commit run --all-files
Github Actions workflow
๋ก์ปฌ pre-commit
โข
์ฝ๋๊ฐ ๋ ํฌ์งํ ๋ฆฌ์ ํธ์๋๊ธฐ ์ ์ ์ค๋ฅ๋ฅผ ์ก๊ณ ์์ ํ ์ ์๊ฒ ๋์์ค
โข
๋ก์ปฌ์์ ์ปค๋ฐ์ ์์ฑํ ๋๋ง๋ค ์คํ
Github Actions workflow
โข
์ฝ๋๊ฐ ๋ ํฌ์งํ ๋ฆฌ์ ํ๋ฆฌํ์คํธ ์์ฑ๋ ๋ ์คํ
โข
๋ชจ๋ ์ฝ๋ ๋ณ๊ฒฝ ์ฌํญ์ด ๋์ผํ ๊ฒ์ฌ ๊ท์น์ ๋ฐ๋ฅด๋๋ก (์ต์ข
๊ฒ์ฌ ๋๋)