django-schema-graph
django-schema-graph copied to clipboard
Allow static generation
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.
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