mirror of
https://github.com/pinry/pinry.git
synced 2025-11-18 02:40:40 +01:00
Swap to new settings structure and start adding docker files directly to project
This commit is contained in:
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM python:3
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip install pipenv
|
||||
RUN pipenv install --three --system
|
||||
|
||||
RUN python3 manage.py collectstatic --noinput
|
||||
|
||||
VOLUME /app/static/media
|
||||
|
||||
2
Pipfile
2
Pipfile
@@ -22,3 +22,5 @@ django-compressor = "*"
|
||||
django-tastypie = "==0.12.2"
|
||||
mock = "*"
|
||||
factory-boy = "<2.0,>=1.3"
|
||||
gunicorn = "*"
|
||||
"psycopg2" = "*"
|
||||
|
||||
45
Pipfile.lock
generated
45
Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "522eabeab156aa95010bc11eae7de51a0be17ebae575656597e698aba07c7f9a"
|
||||
"sha256": "03110b40f521ca462a63d092602bae16130febac8dfea6f7f536e19ab622d975"
|
||||
},
|
||||
"host-environment-markers": {
|
||||
"implementation_name": "cpython",
|
||||
@@ -9,9 +9,9 @@
|
||||
"os_name": "posix",
|
||||
"platform_machine": "x86_64",
|
||||
"platform_python_implementation": "CPython",
|
||||
"platform_release": "4.4.0-112-generic",
|
||||
"platform_release": "4.4.0-43-Microsoft",
|
||||
"platform_system": "Linux",
|
||||
"platform_version": "#135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018",
|
||||
"platform_version": "#1-Microsoft Wed Dec 31 14:42:53 PST 2014",
|
||||
"python_full_version": "3.5.2",
|
||||
"python_version": "3.5",
|
||||
"sys_platform": "linux"
|
||||
@@ -95,6 +95,13 @@
|
||||
],
|
||||
"version": "==1.3.0"
|
||||
},
|
||||
"gunicorn": {
|
||||
"hashes": [
|
||||
"sha256:75af03c99389535f218cc596c7de74df4763803f7b63eb09d77e92b3956b36c6",
|
||||
"sha256:eee1169f0ca667be05db3351a0960765620dad53f53434262ff8901b68a1b622"
|
||||
],
|
||||
"version": "==19.7.1"
|
||||
},
|
||||
"idna": {
|
||||
"hashes": [
|
||||
"sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4",
|
||||
@@ -162,6 +169,38 @@
|
||||
],
|
||||
"version": "==5.0.0"
|
||||
},
|
||||
"psycopg2": {
|
||||
"hashes": [
|
||||
"sha256:aeaba399254ca79c299d9fe6aa811d3c3eac61458dee10270de7f4e71c624998",
|
||||
"sha256:1d90379d01d0dc50ae9b40c863933d87ff82d51dd7d52cea5d1cb7019afd72cd",
|
||||
"sha256:36030ca7f4b4519ee4f52a74edc4ec73c75abfb6ea1d80ac7480953d1c0aa3c3",
|
||||
"sha256:7cbc3b21ce2f681ca9ad2d8c0901090b23a30c955e980ebf1006d41f37068a95",
|
||||
"sha256:b178e0923c93393e16646155794521e063ec17b7cc9f943f15b7d4b39776ea2c",
|
||||
"sha256:fe6a7f87356116f5ea840c65b032af17deef0e1a5c34013a2962dd6f99b860dd",
|
||||
"sha256:6f302c486132f8dd11f143e919e236ea4467d53bf18c451cac577e6988ecbd05",
|
||||
"sha256:888bba7841116e529f407f15c6d28fe3ef0760df8c45257442ec2f14f161c871",
|
||||
"sha256:932a4c101af007cb3132b1f8a9ffef23386acc53dad46536dc5ba43a3235ae02",
|
||||
"sha256:179c52eb870110a8c1b460c86d4f696d58510ea025602cd3f81453746fccb94f",
|
||||
"sha256:33f9e1032095e1436fa9ec424abcbd4c170da934fb70e391c5d78275d0307c75",
|
||||
"sha256:092a80da1b052a181b6e6c765849c9b32d46c5dac3b81bf8c9b83e697f3cdbe8",
|
||||
"sha256:f3d3a88128f0c219bdc5b2d9ccd496517199660cea021c560a3252116df91cbd",
|
||||
"sha256:19983b77ec1fc2a210092aa0333ee48811fd9fb5f194c6cd5b927ed409aea5f8",
|
||||
"sha256:027ae518d0e3b8fff41990e598bc7774c3d08a3a20e9ecc0b59fb2aaaf152f7f",
|
||||
"sha256:363fbbf4189722fc46779be1fad2597e2c40b3f577dc618f353a46391cf5d235",
|
||||
"sha256:d74cf9234ba76426add5e123449be08993a9b13ff434c6efa3a07caa305a619f",
|
||||
"sha256:32702e3bd8bfe12b36226ba9846ed9e22336fc4bd710039d594b36bd432ae255",
|
||||
"sha256:8eb94c0625c529215b53c08fb4e461546e2f3fc96a49c13d5474b5ad7aeab6cf",
|
||||
"sha256:8ebba5314c609a05c6955e5773c7e0e57b8dd817e4f751f30de729be58fa5e78",
|
||||
"sha256:27467fd5af1dcc0a82d72927113b8f92da8f44b2efbdb8906bd76face95b596d",
|
||||
"sha256:b68e89bb086a9476fa85298caab43f92d0a6af135a5f433d1f6b6d82cafa7b55",
|
||||
"sha256:0b9851e798bae024ed1a2a6377a8dab4b8a128a56ed406f572f9f06194e4b275",
|
||||
"sha256:733166464598c239323142c071fa4c9b91c14359176e5ae7e202db6bcc1d2eb5",
|
||||
"sha256:ad75fe10bea19ad2188c5cb5fc4cdf53ee808d9b44578c94a3cd1e9fc2beb656",
|
||||
"sha256:8966829cb0d21a08a3c5ac971a2eb67c3927ae27c247300a8476554cc0ce2ae8",
|
||||
"sha256:8bf51191d60f6987482ef0cfe8511bbf4877a5aa7f313d7b488b53189cf26209"
|
||||
],
|
||||
"version": "==2.7.4"
|
||||
},
|
||||
"python-dateutil": {
|
||||
"hashes": [
|
||||
"sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c",
|
||||
|
||||
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres
|
||||
web:
|
||||
build: .
|
||||
command: gunicorn pinry.wsgi:application -b 0.0.0.0:80 --timeout 30 --log-file -
|
||||
ports:
|
||||
- "80:80"
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
- SECRET_KEY=CHANGE-ME
|
||||
volumes:
|
||||
- media:/app/static/media
|
||||
|
||||
volumes:
|
||||
media:
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings.development")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
|
||||
0
pinry/settings/__init__.py
Normal file
0
pinry/settings/__init__.py
Normal file
@@ -3,16 +3,7 @@ import os
|
||||
from django.contrib.messages import constants as messages
|
||||
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'REPLACE-ME'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
# SECURITY WARNING: use your actual domain name in production!
|
||||
ALLOWED_HOSTS = ['*']
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -73,16 +64,6 @@ MEDIA_ROOT = os.path.join(STATIC_ROOT, 'media')
|
||||
|
||||
WSGI_APPLICATION = 'pinry.wsgi.application'
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
|
||||
|
||||
21
pinry/settings/development.py
Normal file
21
pinry/settings/development.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from .base import *
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'REPLACE-ME'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
# SECURITY WARNING: use your actual domain name in production!
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
24
pinry/settings/docker.py
Normal file
24
pinry/settings/docker.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from .base import *
|
||||
|
||||
|
||||
# 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!
|
||||
DEBUG = False
|
||||
|
||||
# SECURITY WARNING: use your actual domain name in production!
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'db',
|
||||
'PORT': 5432,
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings.docker")
|
||||
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
Reference in New Issue
Block a user