From 93a4e5dc1396b39a06d99836a6fd15aefd239666 Mon Sep 17 00:00:00 2001 From: Mark Norman Francis Date: Wed, 28 Jul 2021 15:41:54 +0100 Subject: [PATCH] How to run in dev --- README.markdown | 30 ++++++++++++++++++++++++++++++ manage | 9 ++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 179fe02..c6cf297 100644 --- a/README.markdown +++ b/README.markdown @@ -5,6 +5,36 @@ A place to collection my tshirt wearing history. +## Generated static sites + +Running in development: + + # bring up the stack + export HASWORN_ENV=dev + ./start + + # if this is a new checkout, or volumes have been removed + ./manage collectstatic --noinput + ./manage migrate + DJANGO_SUPERUSER_PASSWORD=admin ./manage createsuperuser \ + --username admin --email admin@example.com --noinput + +To test a generated hasworn site: + + ./manage import_csv sample/norm.csv + ./manage generate_site norm + ( cd baked/norm && python -m http.server 8080 ) + + +When done developing: + + # shut down temporarily + ./compose down + + # shut down and remove volumes to start afresh (or when development stops) + ./compose down --volumes + + ## Scripts Scripts to interact with docker-compose, using the right configuration and diff --git a/manage b/manage index e22d9b8..38f2a1a 100755 --- a/manage +++ b/manage @@ -1,3 +1,10 @@ #!/usr/bin/env -S bash -euo pipefail -./compose run app python manage.py "$@" +declare -a env_vars + +[ -n "${DJANGO_SUPERUSER_PASSWORD:-}" ] \ + && env_vars+=(-e DJANGO_SUPERUSER_PASSWORD=$DJANGO_SUPERUSER_PASSWORD) + +./compose run \ + "${env_vars[@]}" \ + app python manage.py "$@"