Removed the command 'run-script' and added the command 'shell', and updated the docs and README
This commit is contained in:
parent
a9c5ec34fc
commit
aa85ac5ffc
5 changed files with 38 additions and 44 deletions
|
@ -40,7 +40,5 @@ The releases are versioned after the following scheme:
|
||||||
|
|
||||||
`MAJOR`.`MINOR`
|
`MAJOR`.`MINOR`
|
||||||
|
|
||||||
- `MAJOR`: will include changes
|
- `MAJOR`: may include **breaking changes** and/or significant new features
|
||||||
-> may be incompatible with the previous version
|
- `MINOR`: will only include bugfixes and smaller, **non-breaking changes**
|
||||||
- `MINOR`: will only include bugfixes and smaller changes
|
|
||||||
-> may not be incompatible with the previous version
|
|
||||||
|
|
|
@ -10,55 +10,60 @@ You run a command with
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`server` - Start the server
|
### `server`
|
||||||
This starts a caddy instance, uvicorn with the django application and a scheduler that automatically removes expired session data.
|
This starts the application (a caddy instance, uvicorn with the Django application and a scheduler that automatically removes expired session data).
|
||||||
Log files will be written.
|
Log files will be written.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`setup` - Set up the application
|
### `setup`
|
||||||
This sets up some database tables, views, and more, generates a secret key for the application and lets you create an admin user.
|
This sets up some database tables, views, and more, generates a secret key for the application and lets you create an admin user.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`create-admin` - Lets you create an admin user
|
### `create-admin`
|
||||||
|
Lets you create an admin user
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`generate-secret-key` - generate a new random secret key for django
|
### `generate-secret-key`
|
||||||
|
Generate a new random secret key for Django.
|
||||||
This will overwrite the old one.
|
This will overwrite the old one.
|
||||||
Warning: After running this, current sessions will be invalid, and the users have to relogin. Don't run this command while the server is running.
|
Warning: After running this, current sessions will be invalid, and the users have to relogin. Don't run this command while the server is running.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`clear-sessions` - manually remove all expired sessions from the database
|
### `clear-sessions`
|
||||||
|
manually remove all expired sessions from the database
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`force-db-upgrade` - force a database migration and -upgrade
|
### `force-db-upgrade`
|
||||||
|
force a database migration and -upgrade.
|
||||||
This is mainly used in development.
|
This is mainly used in development.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`archive-tables` - archive (copy & delete) all entries in app_order and app_registertransaction
|
### `archive-tables`
|
||||||
|
archive (copy & delete) all entries in app_order and app_registertransaction.
|
||||||
Use this to archive old orders or transactions (e.g. when the database gets too big).
|
Use this to archive old orders or transactions (e.g. when the database gets too big).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`development-server` - Start the development server
|
### `development-server`
|
||||||
This starts a caddy instance, the django development server with DEBUGGING enabled and the session-clear-scheduler.
|
This starts a caddy instance, the Django development server with DEBUGGING enabled and the session-clear-scheduler.
|
||||||
Only the HTTP-Access-Log will be written to its logfile, other logs will be written to the console.
|
Only the HTTP-Access-Log will be written to its logfile, other logs will be written to the console.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`run-script <path>` - Run a python script in the context of the django project (experimental)
|
### `shell`
|
||||||
`<path>` is the path to the python script
|
|
||||||
|
|
||||||
Keep in mind that the current directory won't be changed automatically to the parent folder of the script file.
|
Start a Django shell.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
`help` - Show a help text
|
### `help`
|
||||||
|
Show a help text
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# run a script in the context of the django project
|
|
||||||
|
|
||||||
export DJANGO_DEBUG="true"
|
|
||||||
|
|
||||||
if [ -z $2 ]; then
|
|
||||||
|
|
||||||
echo "Missing second argument <path>: the path to the script"
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
oldcwd="$(pwd)"
|
|
||||||
script_path=$2
|
|
||||||
echo "Starting $2 in a django shell:"
|
|
||||||
echo -e "--------------------------------------------------------------------------------\n"
|
|
||||||
cat "$script_path" | "$(pwd)/application/manage.py" shell
|
|
||||||
echo -e "\n--------------------------------------------------------------------------------"
|
|
||||||
cd "$oldcwd"
|
|
||||||
|
|
||||||
fi
|
|
12
lib/start-django-shell.sh
Normal file
12
lib/start-django-shell.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# start a django shell
|
||||||
|
|
||||||
|
export DJANGO_DEBUG="true"
|
||||||
|
|
||||||
|
oldcwd="$(pwd)"
|
||||||
|
echo "Starting a django shell..."
|
||||||
|
echo -e "--------------------------------------------------------------------------------\n"
|
||||||
|
"$(pwd)/application/manage.py" shell
|
||||||
|
echo -e "\n--------------------------------------------------------------------------------"
|
||||||
|
cd "$oldcwd"
|
10
run.sh
10
run.sh
|
@ -8,12 +8,12 @@ function show_dm_help { # $1 = exit code
|
||||||
echo -e " server\t\tstart server"
|
echo -e " server\t\tstart server"
|
||||||
echo -e " setup\t\t\tset up the application"
|
echo -e " setup\t\t\tset up the application"
|
||||||
echo -e " create-admin\t\tcreate an admin account"
|
echo -e " create-admin\t\tcreate an admin account"
|
||||||
echo -e " generate-secret-key\tgenerate a new random secret key for django"
|
echo -e " generate-secret-key\tgenerate a new random secret key for Django"
|
||||||
echo -e " clear-sessions\tmanually remove all expired sessions from the database"
|
echo -e " clear-sessions\tmanually remove all expired sessions from the database"
|
||||||
echo -e " force-db-upgrade\tforce a database migration & upgrade"
|
echo -e " force-db-upgrade\tforce a database migration & upgrade"
|
||||||
echo -e " archive-tables\tarchive (copy & delete) all entries in app_order and app_registertransaction"
|
echo -e " archive-tables\tarchive (copy & delete) all entries in app_order and app_registertransaction"
|
||||||
echo -e " development-server\tstart django development server and enable debugging"
|
echo -e " development-server\tstart Django development server and enable debugging"
|
||||||
echo -e " run-script <path>\tRun a python script in the context of the django project (experimental)"
|
echo -e " shell\t\t\tstart a Django shell"
|
||||||
echo -e " help\t\t\tShow this help text\n"
|
echo -e " help\t\t\tShow this help text\n"
|
||||||
echo -e "\nExamples:\n"
|
echo -e "\nExamples:\n"
|
||||||
echo -e " ./run.sh server"
|
echo -e " ./run.sh server"
|
||||||
|
@ -77,9 +77,9 @@ else
|
||||||
|
|
||||||
python3 "$(pwd)/lib/archive-tables.py"
|
python3 "$(pwd)/lib/archive-tables.py"
|
||||||
|
|
||||||
elif [ $1 = 'run-script' ]; then
|
elif [ $1 = 'shell' ]; then
|
||||||
|
|
||||||
source "$(pwd)/lib/run-script.sh"
|
source "$(pwd)/lib/start-django-shell.sh"
|
||||||
|
|
||||||
elif [ $1 = 'help' ]; then
|
elif [ $1 = 'help' ]; then
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue