django-schema-graph icon indicating copy to clipboard operation
django-schema-graph copied to clipboard

Allow static generation

Open meshy opened this issue 2 years ago • 1 comments

The output of this project is one HTML file and one JS file. It would be valuable to be able to make a static export, so that people can embed them in their docs without needing to run a Django server.

meshy avatar Jul 12 '22 15:07 meshy

As an interim solution, I've found this to work:

#!/bin/bash
set -e

cd src
# The trailing & on the command below detaches it from this script so it runs in the background.
python manage.py runserver 8888 --noreload &
# The $! is used to get the ID of the process in the last command.
# See: https://stackoverflow.com/a/17389526/400691
# We use this at the end of the script to kill the Django service.
DJPID=$!

wget \
    -e robots=off \
    --directory-prefix ../schema-graphs \
    --recursive \
    --convert-links \
    --no-host-directories \
    --adjust-extension \
    --retry-connrefused \
    http://127.0.0.1:8888/schema/
kill $DJPID

meshy avatar Aug 24 '22 17:08 meshy