Skip to content

Commit dfcf420

Browse files
committed
add script for populating with example data
1 parent 0d201d3 commit dfcf420

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

populate-dpotools.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
# dbf, 19 Jul 2025
3+
#
4+
# Populate dpotools with example data
5+
# Example users:
6+
# erwin - is_superuser, is_staff
7+
# hugo - is_staff
8+
# kuno
9+
# user name = user password (caveat!)
10+
11+
### functions
12+
err() {
13+
echo "ERROR (will exit): $*" >&2
14+
}
15+
16+
### sanity checks and settings
17+
# better not run this as root
18+
[[ "${EUID}" -eq "0" ]] &&
19+
{
20+
err "This script is not supposed to be run with root privileges."
21+
exit 1
22+
}
23+
# are we in main project dir?
24+
[[ -f "./manage.py" && -d "./dpotools" ]] ||
25+
{
26+
err "This script must be run in the main dpotools project dir."
27+
exit 1
28+
}
29+
# is a Python venv active (hopefully the project's venv)?
30+
[[ -z "${VIRTUAL_ENV}" ]] &&
31+
{
32+
err "This script must be run with the project's Python venv being active."
33+
exit 1
34+
}
35+
36+
python manage.py makemigrations breach rpa
37+
python manage.py migrate
38+
python manage.py loaddata rpa/fixtures/models-users-groups-permissions.json
39+
python manage.py loaddata examples-breach/example_breachreport_en.json
40+
python manage.py loaddata examples-breach/example_breachreport_de.json
41+
python manage.py loaddata examples-rpa/example_rpa_de.json
42+
python manage.py loaddata examples-rpa/example_rpa_en.json
43+
django-admin compilemessages
44+
45+
exit 0
46+

0 commit comments

Comments
 (0)