- Python 3.13+
- PostgreSQL 14+
- Git
git clone <repository-url>
cd StartLineDev# 가상환경 생성
python3 -m venv venv
# 가상환경 활성화
source venv/bin/activate # macOS/Linux
# 또는
venv\Scripts\activate # Windowspip install -r requirements.txtmacOS:
# Homebrew로 설치
brew install postgresql
# 서비스 시작
brew services start postgresqlWindows:
- PostgreSQL 공식 설치프로그램 다운로드 및 설치
Linux (Ubuntu):
sudo apt-get install postgresql postgresql-contrib
sudo service postgresql start# PostgreSQL 접속 (자신의 PostgreSQL 사용자명으로)
# macOS 사용자 예시:
psql -U $(whoami)
# Windows 사용자 예시:
psql -U postgres
# 데이터베이스 생성 (모두 동일)
CREATE DATABASE startlinedev;
# 확인
\l
# 나가기
\q- macOS: 기본값은 설치된 맥 사용자명 (예:
isujong,john등) - Windows: 기본값은
postgres(설치 중 설정한 비밀번호 필요) - Linux: 기본값은
postgres
# .env 파일 생성 (프로젝트 루트)
cp .env.example .env.env 파일 수정 (각 팀원이 자신의 정보로 수정):
# 각자 자신의 PostgreSQL 사용자명 입력
DB_ENGINE=django.db.backends.postgresql
DB_NAME=startlinedev # 모두 동일
DB_USER=your_postgres_user # 자신의 PostgreSQL 사용자명으로 변경
DB_PASSWORD=your_password # 자신의 PostgreSQL 비밀번호
DB_HOST=localhost
DB_PORT=5432
SECRET_KEY=your-secret-key-here
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1예시:
- macOS 사용자 (isujong):
DB_USER=isujong - Windows 사용자:
DB_USER=postgres
# 마이그레이션 적용
python manage.py migrate
# 관리자 계정 생성 (처음 한 번만)
python manage.py createsuperuserpython manage.py runserver브라우저에서 확인:
- 메인 페이지:
http://localhost:8000 - 관리자 페이지:
http://localhost:8000/admin
psql -d startlinedev -U your_postgres_user
http://localhost:8000/admin
psql -d startlinedev -U isujong
# 테이블 목록
\dt
# 특정 테이블 조회
SELECT * FROM accounts_user;
SELECT * FROM learning_learningresource;
# 나가기
\qpython manage.py shell
from accounts.models import User
User.objects.all()현재 requirements.txt에 포함된 패키지:
Django==5.2.10 # Django 프레임워크
django-allauth==65.14.0 # 사용자 인증
psycopg2-binary==2.9.10 # PostgreSQL 드라이버
pillow==12.1.0 # 이미지 처리
# 현재 사용자 확인
whoami
# PostgreSQL 사용자 생성 (필요시)
createuser -s isujong# 데이터베이스 생성
createdb startlinedevpip install psycopg2-binary
# 또는
pip install --no-binary :all: psycopg2# 마이그레이션 상태 확인
python manage.py showmigrations
# 특정 마이그레이션 제거 (필요시)
python manage.py migrate <app> <migration_number>.env파일 (.gitignore에 포함)db.sqlite3local_settings.pyvenv/디렉토리
✅ 공유할 파일:
requirements.txt(패키지 목록).env.example(샘플 설정)SETUP_GUIDE.md(이 파일)
pip install <package-name>
pip freeze > requirements.txt
git add requirements.txt
git commit -m "Add: <package-name>"python manage.py makemigrations
python manage.py migrate
# 커밋
git add <app>/migrations/<new_migration_file>
git commit -m "Migration: <description>"git pull
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate문제 발생 시 다음 정보를 함께 공유해주세요:
- OS 및 Python 버전:
python --version - PostgreSQL 버전:
psql --version - 전체 에러 메시지
- 수행한 명령어