localinit as makefile added

This commit is contained in:
Dirk Alders 2025-08-07 09:39:58 +02:00
parent 6f26337f60
commit 8af997e354
2 changed files with 24 additions and 0 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