-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
236 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ db.sqlite3 | |
local_settings.py | ||
__pycache__/ | ||
/server/media/images/system/* | ||
/server/staticfiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM python:3.9.6-alpine | ||
|
||
RUN mkdir /app | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN apk add gcc musl-dev g++ zlib-dev jpeg-dev libjpeg postgresql-libs postgresql-dev | ||
|
||
RUN pip install pipenv | ||
|
||
RUN pipenv install | ||
|
||
RUN pip install uvicorn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: '3' | ||
services: | ||
api: | ||
build: . | ||
working_dir: /app/server | ||
command: ['pipenv', 'run', 'gunicorn', 'server.asgi:application', '-k', 'uvicorn.workers.UvicornWorker', '-b', '0.0.0.0:8000', '--capture-output'] | ||
volumes: | ||
- .:/app | ||
depends_on: | ||
- db | ||
environment: | ||
- DATABASE_URL=postgres://root:root@db:5432/api | ||
- DJANGO_SETTINGS_MODULE=server.settings.docker_production | ||
- SECRET_KEY=hogefuga | ||
- LANG=ja_JP.utf8 | ||
- LC_ALL=ja_JP.utf8 | ||
ports: | ||
- "8000:8000" | ||
db: | ||
image: postgres | ||
volumes: | ||
- ./postgres/init:/docker-entrypoint-initdb.d | ||
- ./postgres/data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: api | ||
POSTGRES_INITDB_ARGS: "--encoding=UTF-8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
Django settings for server project. | ||
Generated by 'django-admin startproject' using Django 3.0.6. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.0/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/3.0/ref/settings/ | ||
""" | ||
|
||
import os | ||
import dj_database_url | ||
from .base import * | ||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = os.environ['SECRET_KEY'] | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
if os.getenv("DEBUG", "False") == "False": | ||
DEBUG = False | ||
|
||
ALLOWED_HOSTS = ["*"] | ||
|
||
|
||
# Application definition | ||
|
||
|
||
ROOT_URLCONF = 'server.urls' | ||
|
||
WSGI_APPLICATION = 'server.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': dj_database_url.config() | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
Django settings for server project. | ||
Generated by 'django-admin startproject' using Django 3.0.6. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.0/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/3.0/ref/settings/ | ||
""" | ||
|
||
import os | ||
import dj_database_url | ||
from .base import * | ||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = os.environ['SECRET_KEY'] | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
if os.getenv("DEBUG", "False") == "False": | ||
DEBUG = False | ||
|
||
ALLOWED_HOSTS = ["*"] | ||
|
||
|
||
# Application definition | ||
|
||
|
||
ROOT_URLCONF = 'server.urls' | ||
|
||
WSGI_APPLICATION = 'server.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': dj_database_url.config() | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters