Skip to content

Commit

Permalink
feat: OpenSSL 기반 HTTPS를 사용하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hepheir committed Nov 7, 2023
1 parent 57d924b commit cdba5a0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8000
443
],

// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "python manage.py runserver 0:8000"
"postCreateCommand": ["python", "manage.py", "runsslserver", "--certificate", "/django.cert", "--key", "/django.key", "0:443"]

// Configure tool-specific properties.
// "customizations": {},
Expand Down
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,24 @@ ENV DJANGO__EMAIL_PORT=587
ENV DJANGO__EMAIL_USE_TLS=true


WORKDIR /usr/src/app
COPY . .


# Python 의존성 설치
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .

EXPOSE 8000

# Django 데이터 베이스 구축
RUN python manage.py makemigrations
RUN python manage.py migrate

ENTRYPOINT ["python", "manage.py", "runserver", "0:8000"]

# HTTPS 통신을 위한 세팅
RUN echo "KR\nSeoul\nJongRo\nLikelion-Univ.\nLogged.me\nDjango-server\nhepheir@gmail.com" > django.cert.details
RUN openssl genrsa 2048 > django.key
RUN openssl req -new -x509 -nodes -sha256 -days 365 -key django.key > django.cert < django.cert.details


EXPOSE 443
ENTRYPOINT ["python", "manage.py", "runsslserver", "--certificate", "/django.cert", "--key", "/django.key", "0:443"]
3 changes: 2 additions & 1 deletion config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@

'rest_framework',
'rest_framework_simplejwt',

'corsheaders',
'sslserver',

'user',
'feed',
'badge',
Expand Down
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit cdba5a0

Please sign in to comment.