release/deploy setup

This commit is contained in:
Niko Abeler 2023-06-13 20:35:41 +02:00
parent f91165d7b9
commit 14bbd86391
7 changed files with 83 additions and 24 deletions

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM python:3.11-alpine
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["gunicorn", "-b", "0.0.0.0:8000", "guild_journal.wsgi"]

View File

@ -0,0 +1,8 @@
import os
from .default import *
if os.environ.get("GUILD_JOURNAL_ENV") == "production":
from .production import *
else:
from .development import *

View File

@ -13,20 +13,12 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-e*p%e)pwf+-ntt4wpn-^^7-0yq)!cjo*om18vy77-=*c0jjfqa"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
@ -42,6 +34,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
@ -72,18 +65,6 @@ TEMPLATES = [
WSGI_APPLICATION = "guild_journal.wsgi.application"
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
@ -118,11 +99,13 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
STATIC_URL = "static/"
STATICFILES_DIRS = [
BASE_DIR / "static",
]
STATIC_ROOT = BASE_DIR / "static"
STATICFILES_DIRS = []
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

View File

@ -0,0 +1,22 @@
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-e*p%e)pwf+-ntt4wpn-^^7-0yq)!cjo*om18vy77-=*c0jjfqa"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}

View File

@ -0,0 +1,22 @@
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-e*p%e)pwf+-ntt4wpn-^^7-0yq)!cjo*om18vy77-=*c0jjfqa"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ["*"]
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "/data/db.sqlite3",
}
}

2
release.sh Normal file
View File

@ -0,0 +1,2 @@
docker build . -t git.libove.org/h4kor/guild-journal:$1
docker push git.libove.org/h4kor/guild-journal:$1

13
requirements.txt Normal file
View File

@ -0,0 +1,13 @@
asgiref==3.6.0
black==23.3.0
click==8.1.3
Django==4.2.1
gunicorn==20.1.0
Markdown==3.4.3
mypy-extensions==1.0.0
packaging==23.1
pathspec==0.11.1
platformdirs==3.5.3
ruff==0.0.272
sqlparse==0.4.4
tomli==2.0.1