localinit as makefile added

This commit is contained in:
Dirk Alders 2025-08-07 09:29:20 +02:00
parent 5d8166a64d
commit 5df6bcc390
3 changed files with 27 additions and 4 deletions

18
__make.d__/config.mk Normal file
View File

@ -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

6
__make.d__/run.mk Normal file
View File

@ -0,0 +1,6 @@
.ONESHELL:
SHELL = /usr/bin/bash
.SILENT:
run: init
venv/bin/python manage.py runserver

View File

@ -45,6 +45,9 @@ PASSWORD_RESET_TIMEOUT = 60 * 60 * 3 # 3 hours
# EMAIL_SSL_KEYFILE = # EMAIL_SSL_KEYFILE =
# Define an ssl certificate # Define an ssl certificate
# EMAIL_SSL_CERTFILE = # EMAIL_SSL_CERTFILE =
# Define the administrators (for mail delivery)
# ADMINS = [("PaTT", EMAIL_FROM), ]
# #
# Django # 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! # SECURITY WARNING: don't run with a dummy secret in production! And don't let others read this key!
SECRET_KEY = None SECRET_KEY = None
# Define the administrators (for mail delivery)
ADMINS = [("PaTT", EMAIL_FROM), ]
# This defines the listener hostnames for your django server # 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! # SECURITY WARNING: don't run with '0.0.0.0' in in production, unless you know what you are doing!
# ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ] # ALLOWED_HOSTS = ['<YOUR_SERVER_HOSTNAME>', ]