feat: add comprehensive GitHub workflow and development tools
This commit is contained in:
4
app/core/__init__.py
Normal file
4
app/core/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .celery import app as celery
|
||||
|
||||
__all__ = ("celery",)
|
||||
|
||||
4
app/core/asgi.py
Normal file
4
app/core/asgi.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import os
|
||||
from django.core.asgi import get_asgi_application
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||
application = get_asgi_application()
|
||||
10
app/core/celery.py
Normal file
10
app/core/celery.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
from celery import Celery
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
|
||||
|
||||
app = Celery("core")
|
||||
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||
app.autodiscover_tasks()
|
||||
|
||||
|
||||
102
app/core/settings.py
Normal file
102
app/core/settings.py
Normal file
@@ -0,0 +1,102 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", "dev-secret")
|
||||
DEBUG = os.getenv("DJANGO_DEBUG", "0") == "1"
|
||||
ALLOWED_HOSTS = os.getenv("DJANGO_ALLOWED_HOSTS", "*").split(",")
|
||||
|
||||
# CSRF settings for localhost development
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
'http://localhost:8081',
|
||||
'http://127.0.0.1:8081',
|
||||
]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'rest_framework',
|
||||
'stiftung',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'stiftung.middleware.AuditMiddleware', # Audit logging middleware
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'core.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [BASE_DIR / 'templates'],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
WSGI_APPLICATION = 'core.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': os.getenv('POSTGRES_DB', 'stiftung'),
|
||||
'USER': os.getenv('POSTGRES_USER', 'stiftung'),
|
||||
'PASSWORD': os.getenv('POSTGRES_PASSWORD', 'stiftungpass'),
|
||||
'HOST': os.getenv('DB_HOST', 'db'),
|
||||
'PORT': os.getenv('DB_PORT', '5432'),
|
||||
}
|
||||
}
|
||||
|
||||
LANGUAGE_CODE = os.getenv("LANGUAGE_CODE", "de")
|
||||
TIME_ZONE = os.getenv("TIME_ZONE", "Europe/Berlin")
|
||||
USE_I18N = True
|
||||
USE_TZ = True
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = BASE_DIR / 'media'
|
||||
|
||||
# Celery
|
||||
CELERY_BROKER_URL = os.getenv("REDIS_URL", "redis://redis:6379/0")
|
||||
CELERY_RESULT_BACKEND = os.getenv("REDIS_URL", "redis://redis:6379/0")
|
||||
|
||||
# Paperless
|
||||
PAPERLESS_API_URL = os.getenv("PAPERLESS_API_URL", "http://192.168.178.167:30070")
|
||||
PAPERLESS_API_TOKEN = os.getenv("PAPERLESS_API_TOKEN")
|
||||
PAPERLESS_REQUIRED_TAG = os.getenv("PAPERLESS_REQUIRED_TAG", "Stiftung_Destinatäre")
|
||||
PAPERLESS_LAND_TAG = os.getenv("PAPERLESS_LAND_TAG", "Stiftung_Land_und_Pächter")
|
||||
PAPERLESS_ADMIN_TAG = os.getenv("PAPERLESS_ADMIN_TAG", "Stiftung_Administration")
|
||||
PAPERLESS_DESTINATAERE_TAG_ID = os.getenv("PAPERLESS_DESTINATAERE_TAG_ID", "210")
|
||||
PAPERLESS_LAND_TAG_ID = os.getenv("PAPERLESS_LAND_TAG_ID", "204")
|
||||
PAPERLESS_ADMIN_TAG_ID = os.getenv("PAPERLESS_ADMIN_TAG_ID", "216")
|
||||
|
||||
# Authentication
|
||||
LOGIN_URL = '/login/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGOUT_REDIRECT_URL = '/login/'
|
||||
|
||||
# Gramps integration
|
||||
GRAMPS_URL = os.environ.get('GRAMPS_URL', 'http://grampsweb:80')
|
||||
GRAMPS_API_TOKEN = os.environ.get('GRAMPS_API_TOKEN', '')
|
||||
GRAMPS_STIFTER_IDS = os.environ.get('GRAMPS_STIFTER_IDS', '') # comma-separated
|
||||
GRAMPS_USERNAME = os.environ.get('GRAMPS_USERNAME', '')
|
||||
GRAMPS_PASSWORD = os.environ.get('GRAMPS_PASSWORD', '')
|
||||
18
app/core/urls.py
Normal file
18
app/core/urls.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib.auth import views as auth_views
|
||||
from stiftung.views import home
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('stiftung.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
# Authentication URLs
|
||||
path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'),
|
||||
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
4
app/core/wsgi.py
Normal file
4
app/core/wsgi.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import os
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||
application = get_wsgi_application()
|
||||
Reference in New Issue
Block a user