IntelliJ Docker 개발 환경 구성하기
-
Required
- Docker desktop app for Mac installed
-
IntelliJ
- docker plugin installed
-
project docker 설정
-
project Docker-dev 설정
- python image, dependency (requirements.txt)
- pip install
-
project docker-compose.yml
-
build :
- context: .
- dockerfile: docker-file-path
-
envirionment:
db image config 설정
-
depends_on:
- db
-
volumes:
- ./:/app
-
-
-
Python SDK 설정
-
Django module 설정
- File > Project Structure > Project Settings > Modules
-
+ New Module
- Python > Django
- Select Prior Python SDK
- Next
-
Set Module Name
- If project already exist, choose that.
-
Set Module settings
- Project root : project root - manage.py located dir.
- Settings : settings.py file path
- Manage script : manage.py file path
-
Django 실행 설정
-
Open Run/Debug Configuration
- Host : 0.0.0.0
- Port: could be differ
-
Environment variables:
- if settings.py is different from default, add DJANGOSETTINGSMODULE= <file path with . >
-
Python Interpreter:
- Use Specified Interpreter: Select prior python SDK.
-
Docker compose
- command and options:
up --build django
- command and options:
-
Extra
* if python manage.py or other python commands required,
$docker-compose exec <docker-compose service name> sh -c 'python some command with args'
NOTICE:
Command will excute on /app/curernt-project-dir in Docker Containter.