diff --git a/README.md b/README.md index cd12fbf..e557514 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,5 @@ The releases are versioned after the following scheme: `MAJOR`.`MINOR` -- `MAJOR`: will include changes - -> may be incompatible with the previous version -- `MINOR`: will only include bugfixes and smaller changes - -> may not be incompatible with the previous version +- `MAJOR`: may include **breaking changes** and/or significant new features +- `MINOR`: will only include bugfixes and smaller, **non-breaking changes** diff --git a/docs/Commands.md b/docs/Commands.md index ff0cee2..b47bbc3 100644 --- a/docs/Commands.md +++ b/docs/Commands.md @@ -10,55 +10,60 @@ You run a command with --- -`server` - Start the server -This starts a caddy instance, uvicorn with the django application and a scheduler that automatically removes expired session data. +### `server` +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. --- -`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. --- -`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. 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. --- -`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). --- -`development-server` - Start the development server -This starts a caddy instance, the django development server with DEBUGGING enabled and the session-clear-scheduler. +### `development-server` +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. --- -`run-script ` - Run a python script in the context of the django project (experimental) -`` is the path to the python script +### `shell` -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 --- diff --git a/lib/run-script.sh b/lib/run-script.sh deleted file mode 100644 index ffc4ece..0000000 --- a/lib/run-script.sh +++ /dev/null @@ -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 : 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 diff --git a/lib/start-django-shell.sh b/lib/start-django-shell.sh new file mode 100644 index 0000000..a696310 --- /dev/null +++ b/lib/start-django-shell.sh @@ -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" \ No newline at end of file diff --git a/run.sh b/run.sh index c015033..a1664c5 100755 --- a/run.sh +++ b/run.sh @@ -8,12 +8,12 @@ function show_dm_help { # $1 = exit code echo -e " server\t\tstart server" echo -e " setup\t\t\tset up the application" 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 " 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 " development-server\tstart django development server and enable debugging" - echo -e " run-script \tRun a python script in the context of the django project (experimental)" + echo -e " development-server\tstart Django development server and enable debugging" + echo -e " shell\t\t\tstart a Django shell" echo -e " help\t\t\tShow this help text\n" echo -e "\nExamples:\n" echo -e " ./run.sh server" @@ -77,9 +77,9 @@ else 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