Velog-Dashboard v2의 데이터, 스크래핑, 백오피스용 레포지토리입니다.
- Python 3.13.0+
- Poetry 1.8.4+
pyenv와poetry가 설치되었다고 가정하고 진행합니다.poetry대신venv로 대체해서 사용가능합니다. (requirements.txt활용)- 참고로
poetry기반으로poetry export -f requirements.txt --without-hashes -o requirements.txt통해 배포 require를 만들어야 합니다.
# 프로젝트 Clone 및 이동 git clone https://github.com/Check-Data-Out/velog-dashboard-v2-back-office.git cd velog-dashboard-v2-back-office # 전역적으로 3.13 python version 이 아니라면 pyenv local 3.13 # 가상환경 생성 및 패키지 설치 poetry shell poetry install1. dockerdocs를 참고하여 Docker, Docker Compose 설치
- DB 세팅 이후, 실행 전 꼭
superuser을 만들어야 admin 진입 가능
docker를 띄우고python manage.py migrate실행, 아래와 같은 화면
Operations to perform: Apply all migrations: admin, auth, contenttypes, posts, sessions, users Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK ... # 생략python manage.py createsuperuser실행 해서 따라가거나, 아래 명령어 복붙으로 실행
DJANGO_SUPERUSER_USERNAME=admin \ DJANGO_SUPERUSER_EMAIL=admin@example.com \ DJANGO_SUPERUSER_PASSWORD=admin \ python manage.py createsuperuser --noinputSuperuser created successfully.결과를 만나면 성공- 그리고 아래 순서 F/U
poetry run pytest -v # 또는 pytest -v # 또는 아주 상세 디버깅을 위해 poetry run pytest -v --full-trace --showlocals --tb=long --capture=no # 또는 pytest 이후부터 쭉conftest.py파일은pytest을 위한 자동fixture세팅 파일임coverage는 아래와 같이 사용함
poetry run coverage run -m pytest poetry run coverage report -m poetry run coverage html# Formatting ruff format # Linting ruff check --fix- need to be done
poetry config
poetry show pre-commit # check the result poetry run pre-commit install # the result will be >> pre-commit installed at .git/hooks/pre-commit # pre-commit testing poetry run pre-commit run --all-files# Local 환경 python manage.py runserver # Prod 환경으로 실행 python manage.py runserver --settings=backoffice.settings.prod # 이후 localhost:8000로 접속 # admin / admin 으로 로그인