django et compose opé

This commit is contained in:
Jonas Legion 2021-06-10 12:42:55 +02:00
parent 4d6ab81ec6
commit 74ab174ce4
4 changed files with 33 additions and 22 deletions

View File

@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/ https://docs.djangoproject.com/en/3.1/ref/settings/
""" """
import os
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -20,12 +20,16 @@ BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xvpvye-st)659v9x)$ypt16#iof8rh&*04v#nryi@n+u)(d@9v' SECRET_KEY = os.environ.get('DJANGO_SECRET')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True # noinspection DjangoDebugModeSettings
if os.environ.get('DEBUG_DJANGO') == "True":
DEBUG = True
else:
DEBUG = False
ALLOWED_HOSTS = [] ALLOWED_HOSTS = ['*']
# Application definition # Application definition
@ -75,8 +79,12 @@ WSGI_APPLICATION = 'TiBillet.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django_tenants.postgresql_backend', # Add 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': BASE_DIR / 'db.sqlite3', 'NAME': os.environ.get('POSTGRES_DB'),
'USER': os.environ.get('POSTGRES_USER'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': os.environ.get('POSTGRES_HOST'),
'PORT': os.environ.get('POSTGRES_PORT', '5432'),
} }
} }

1
DjangoFiles/launch.sh Executable file
View File

@ -0,0 +1 @@
sleep 36d

View File

@ -1,10 +1,11 @@
version: '3.7' version: '3.7'
services: services:
tibillet_postgres: tibillet_postgres:
container_name: tibillet_postgres
image: postgres:11.5-alpine image: postgres:11.5-alpine
restart: always restart: always
volumes: volumes:
- "../Postgres/dbdata:/var/lib/postgresql/data" - "../../Postgres/dbdata:/var/lib/postgresql/data"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
environment: environment:
POSTGRES_USER: ${POSTGRES_USER} POSTGRES_USER: ${POSTGRES_USER}
@ -13,14 +14,15 @@ services:
tibillet_django: tibillet_django:
container_name: tibillet_django
build: ../Dockerfile/ build: ../Dockerfile/
restart: always restart: always
env_file: .env env_file: .env
ports: ports:
- 8002:8002 - 8002:8002
volumes: volumes:
- "../DjangoFiles:/DjangoFiles" - "../../DjangoFiles:/DjangoFiles"
- "../Docker/bashrc:/root/.bashrc" - "../../Docker/bashrc:/root/.bashrc"
working_dir: /DjangoFiles working_dir: /DjangoFiles
command: "bash /DjangoFiles/launch.sh" command: "bash /DjangoFiles/launch.sh"
depends_on: depends_on:

View File

@ -1,20 +1,20 @@
# CHANGE ME # CHANGE ME
DJANGO_SECRET = 'ingeci8ar6Ahr6aiBi!ghovezahs@eiNgai4eingaa1zaeRi7E' DJANGO_SECRET='ingeci8ar6Ahr6aiBi!ghovezahs@eiNgai4eingaa1zaeRi7E'
POSTGRES_HOST = 'ticket_postgres' POSTGRES_HOST='tibillet_postgres'
POSTGRES_USER = 'ticket_postgres_user' POSTGRES_USER='tibillet_postgres_user'
POSTGRES_PASSWORD = 'ticket_postgres_password' POSTGRES_PASSWORD='tibillet_postgres_password'
POSTGRES_DB = 'ticket' POSTGRES_DB='tibillet'
DEBUG_DJANGO = True DEBUG_DJANGO=True
TIME_ZONE = 'Indian/Reunion' TIME_ZONE='Indian/Reunion'
DOMAIN= 'tibillet-local.me' DOMAIN='tibillet-local.me'
EMAIL= 'me@me.me' EMAIL='me@me.me'
EMAIL_HOST = "" EMAIL_HOST=""
EMAIL_PORT = "" EMAIL_PORT=""
EMAIL_HOST_USER = "" EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD = "" EMAIL_HOST_PASSWORD=""
MOLLIE_API_KEY = "" MOLLIE_API_KEY = ""