From 3603d26f1e926679c290ef29375d69fcf13d61d3 Mon Sep 17 00:00:00 2001 From: bronsen Date: Thu, 21 Nov 2024 12:04:40 +0100 Subject: [PATCH] [project] start with minimal project mainly, so we have a `manage.py` script --- src/dx/__init__.py | 0 src/dx/settings.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++ src/dx/urls.py | 1 + src/manage.py | 18 ++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 src/dx/__init__.py create mode 100644 src/dx/settings.py create mode 100644 src/dx/urls.py create mode 100755 src/manage.py diff --git a/src/dx/__init__.py b/src/dx/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/dx/settings.py b/src/dx/settings.py new file mode 100644 index 0000000..add55c3 --- /dev/null +++ b/src/dx/settings.py @@ -0,0 +1,47 @@ +from pathlib import Path +from configurations import Configuration + +BASE_DIR = Path(__file__).resolve().parent.parent + + +class Base(Configuration): + DEBUG = False + DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + + INSTALLED_APPS = [ + "dx", + ] + + ROOT_URLCONF = "dx.urls" + + SECRET_KEY = "django-insecure-cbgvn=orgh$&6l-w91pp2=(b#hjwe1z&ijwiafgt(py1lq5i85" + + TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [BASE_DIR / "templates"], + "APP_DIRS": True, + }, + ] + + USE_TZ = True + + +class Dev(Base): + # Dangerous: disable host header validation + ALLOWED_HOSTS = ["*"] + + DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": "db.sqlite3", + }, + } + + DEBUG = True + + INSTALLED_APPS = Base.INSTALLED_APPS + ["django_extensions"] + + +class Local(Dev): + pass diff --git a/src/dx/urls.py b/src/dx/urls.py new file mode 100644 index 0000000..637600f --- /dev/null +++ b/src/dx/urls.py @@ -0,0 +1 @@ +urlpatterns = [] diff --git a/src/manage.py b/src/manage.py new file mode 100755 index 0000000..22d839f --- /dev/null +++ b/src/manage.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" + +import os +import sys + + +def main(): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dx.settings") + os.environ.setdefault("DJANGO_CONFIGURATION", "Base") + + from configurations.management import execute_from_command_line + + execute_from_command_line(sys.argv) + + +if __name__ == "__main__": + main()