Skip to content

Commit 50718fb

Browse files
committed
feat: mysqlclient로 전환
1 parent 4f15ec8 commit 50718fb

4 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎.env.example‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ KAKAO_CLIENT_SECRET=
4040
# ------------------------------------------
4141
# DB_ENGINE 을 비워두면(또는 이 줄을 지우면) 로컬 개발용 SQLite 로 동작합니다.
4242
# MySQL 로 전환하려면 아래 주석을 해제하고 접속 정보를 채우세요.
43-
# (드라이버: mysql-connector-python)
43+
# (드라이버: mysqlclient — requirements-prod.txt 로 설치)
4444

45-
# DB_ENGINE=mysql.connector.django
45+
# DB_ENGINE=django.db.backends.mysql
4646
# DB_NAME=caffeine_diary
4747
# DB_USER=
4848
# DB_PASSWORD=

‎config/settings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _env_list(key, default):
126126
# Database
127127
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
128128
# DB_ENGINE 미설정 시 로컬 개발용 SQLite로 폴백. 운영에서는 .env에
129-
# DB_ENGINE=mysql.connector.django (MySQL Connector/Python) 및 접속 정보를 채워 전환한다.
129+
# DB_ENGINE=django.db.backends.mysql (드라이버: mysqlclient) 및 접속 정보를 채워 전환한다.
130130

131131
DB_ENGINE = _env("DB_ENGINE", "django.db.backends.sqlite3")
132132

‎requirements-prod.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 운영/배포 전용 의존성 (Docker 리눅스 이미지 또는 EC2에서 설치)
2+
# pip install -r requirements-prod.txt
3+
#
4+
# ⚠️ mysqlclient 는 C 확장이라 빌드에 시스템 라이브러리가 필요하다.
5+
# - Debian/Ubuntu(Docker): apt-get install -y default-libmysqlclient-dev build-essential pkg-config
6+
# - 로컬 Mac 개발에는 설치하지 말 것 (SQLite로 개발). requirements.txt 만 쓰면 된다.
7+
8+
-r requirements.txt
9+
10+
mysqlclient==2.2.7 # MySQL 드라이버 (Django 공식 권장, ENGINE=django.db.backends.mysql)
11+
gunicorn==23.0.0 # WSGI 서버 (nginx 뒤에서 실행)

‎requirements.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ python-dotenv==1.2.2
77
requests==2.34.2
88
pillow==12.3.0
99

10-
# 배포용 (운영 환경)
11-
mysql-connector-python==9.1.0 # MySQL 드라이버 (Oracle 공식, 순수/C 겸용). ENGINE=mysql.connector.django
12-
gunicorn==23.0.0 # WSGI 서버 (nginx 뒤에서 실행)
10+
# 배포용(MySQL 드라이버·WSGI 서버)은 requirements-prod.txt 로 분리했다.
11+
# 로컬 개발은 이 파일만 설치하면 SQLite로 동작한다.
12+
# 운영/Docker: pip install -r requirements-prod.txt

0 commit comments

Comments
 (0)