Add Procfile and Docker file

This commit is contained in:
Gregory Trullemans 2024-06-20 07:23:56 +02:00
parent 30287e0ec0
commit 9283638ba8
3 changed files with 45 additions and 6 deletions

2
Procfile Normal file
View File

@ -0,0 +1,2 @@
release: python manage.py migrate
web: gunicorn config.wsgi

View File

@ -12,6 +12,26 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import environ
from pathlib import Path
# Initialise environment variables
env = environ.Env()
environ.Env.read_env()
# Sentry
SENTRY_DSN = env("SENTRY_DSN", default=None)
if SENTRY_DSN is not None:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()],
traces_sample_rate=env("SENTRY_TRACES_SAMPLE_RATE", default=1.0),
send_default_pii=True,
debug=env("SENTRY_DEBUG", default=True),
)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -20,12 +40,12 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'mvu)=%+ocv3n9dljxq0===$v!01@rw2j$++i&h6#65cu1#0ff@'
SECRET_KEY = env("SECRET_KEY", default="Super Little Poney 2000")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = env("ALLOWED_HOSTS", default="localhost").split()
# Application definition
@ -75,11 +95,14 @@ WSGI_APPLICATION = 'comptabilite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
"default": env.db_url("DATABASE_URL", default=os.path.join(BASE_DIR, 'db.sqlite3'))
}

14
docker-compose.yaml Normal file
View File

@ -0,0 +1,14 @@
version: "3"
services:
db:
image: "postgres:14"
restart: always
container_name: "compta_inde_db_container"
environment:
POSTGRES_DB: "compta_inde_db"
POSTGRES_USER: "Greg&Arnaud"
POSTGRES_PASSWORD: "K&kP4t4t0r1!"
ports:
- "5432:5432"
volumes:
- ./data:/var/lib/postgresql/data