From 5df6bcc3909311873cc544c070595a269d436bfc Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Thu, 7 Aug 2025 09:29:20 +0200 Subject: [PATCH] localinit as makefile added --- __make.d__/config.mk | 18 ++++++++++++++++++ __make.d__/run.mk | 6 ++++++ config_example/config.py | 7 +++---- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 __make.d__/config.mk create mode 100644 __make.d__/run.mk diff --git a/__make.d__/config.mk b/__make.d__/config.mk new file mode 100644 index 0000000..ae2ecec --- /dev/null +++ b/__make.d__/config.mk @@ -0,0 +1,18 @@ +.ONESHELL: +SHELL = /usr/bin/bash +.SILENT: + +localinit: + if [[ ! -e config.py ]]; then + cp config_example/config.py config.py + chmod 600 config.py + SECRET_KEY=$$(python -c "import random; print(''.join([random.choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for n in range(50)]))") + sed -i "/^SECRET_KEY.*=.*None/c\SECRET_KEY = \"$$SECRET_KEY\"" config.py + sed -i "/^DEBUG.*=.*/c\DEBUG = True" config.py + fi + if [[ ! -e db.sqlite3 ]]; then + venv/bin/python manage.py migrate + echo "*****************************************************************************************" + echo "** YOU might want to create asuperuser with: venv/bin/python manage.py createsuperuser **" + echo "*****************************************************************************************" + fi diff --git a/__make.d__/run.mk b/__make.d__/run.mk new file mode 100644 index 0000000..8f2ecce --- /dev/null +++ b/__make.d__/run.mk @@ -0,0 +1,6 @@ +.ONESHELL: +SHELL = /usr/bin/bash +.SILENT: + +run: init + venv/bin/python manage.py runserver diff --git a/config_example/config.py b/config_example/config.py index 4d086e6..b3e25ca 100644 --- a/config_example/config.py +++ b/config_example/config.py @@ -45,6 +45,9 @@ PASSWORD_RESET_TIMEOUT = 60 * 60 * 3 # 3 hours # EMAIL_SSL_KEYFILE = # Define an ssl certificate # EMAIL_SSL_CERTFILE = +# Define the administrators (for mail delivery) +# ADMINS = [("PaTT", EMAIL_FROM), ] + # # Django @@ -57,10 +60,6 @@ DEBUG = False # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key! SECRET_KEY = None -# Define the administrators (for mail delivery) -ADMINS = [("PaTT", EMAIL_FROM), ] - - # This defines the listener hostnames for your django server # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing! # ALLOWED_HOSTS = ['', ]