feat: update database path configuration and improve entrypoint script for SQLite handling
This commit is contained in:
+4
-3
@@ -3,12 +3,13 @@ set -eu
|
||||
|
||||
APP_DIR="$1"
|
||||
PORT="$2"
|
||||
DB_PATH="${DJANGO_DB_PATH:-$APP_DIR/db/db.sqlite3}"
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
mkdir -p logs static
|
||||
mkdir -p logs static "$(dirname "$DB_PATH")"
|
||||
|
||||
if [ ! -f "$APP_DIR/db.sqlite3" ] && [ "${LOAD_FIXTURE_ON_EMPTY_DB:-true}" = "true" ]; then
|
||||
if [ ! -f "$DB_PATH" ] && [ "${LOAD_FIXTURE_ON_EMPTY_DB:-true}" = "true" ]; then
|
||||
TMP_DUMP="$(mktemp)"
|
||||
python /app/scripts/rewrite_dumps.py dumps/example.json "$TMP_DUMP"
|
||||
python manage.py migrate
|
||||
@@ -22,7 +23,7 @@ fi
|
||||
# Collect them into STATIC_ROOT so the explicit /static/ URL can serve them.
|
||||
python manage.py collectstatic --noinput
|
||||
|
||||
if grep -aEq '127\.0\.0\.1|provider:8002' "$APP_DIR/db.sqlite3"; then
|
||||
if grep -aEq '127\.0\.0\.1|provider:8002' "$DB_PATH"; then
|
||||
echo "Refusing to start: bootstrap data still contains internal/local URLs" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user