localinit as makefile added

This commit is contained in:
Dirk Alders 2025-08-07 09:33:58 +02:00
parent abf7e044df
commit e901bf4a5d
3 changed files with 28 additions and 4 deletions

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

@ -0,0 +1,20 @@
.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
venv/bin/python manage.py import_system_pages
venv/bin/python manage.py rebuild_index
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

@ -53,6 +53,8 @@ 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 = [("Piki", EMAIL_FROM), ]
#
# Django
@ -65,10 +67,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 = [("Piki", 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 = ['<YOUR_SERVER_HOSTNAME>', ]