23 lines
525 B
Bash
23 lines
525 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
APP_DIR="$1"
|
|
PORT="$2"
|
|
|
|
cd "$APP_DIR"
|
|
|
|
mkdir -p logs static
|
|
|
|
if [ ! -f "$APP_DIR/db.sqlite3" ] && [ "${LOAD_FIXTURE_ON_EMPTY_DB:-true}" = "true" ]; then
|
|
python manage.py migrate
|
|
python manage.py loaddata dumps/example.json
|
|
else
|
|
python manage.py migrate
|
|
fi
|
|
|
|
# With DEBUG disabled Django no longer serves app static assets implicitly.
|
|
# Collect them into STATIC_ROOT so the explicit /static/ URL can serve them.
|
|
python manage.py collectstatic --noinput
|
|
|
|
exec python manage.py runserver 0.0.0.0:"$PORT"
|