Spaces:
Paused
Paused
BPEL Bot commited on
Commit ·
12667cd
1
Parent(s): cc0ab66
Remove collectstatic step
Browse files- Dockerfile +1 -2
- README.md +4 -5
- docker-entrypoint.sh +0 -5
Dockerfile
CHANGED
|
@@ -22,8 +22,7 @@ ENV OTREE_PRODUCTION=1 \
|
|
| 22 |
OTREE_DATABASE_URL=sqlite:////data/otree.sqlite3 \
|
| 23 |
PYTHONPATH=/app
|
| 24 |
|
| 25 |
-
RUN mkdir -p /data
|
| 26 |
-
&& otree collectstatic --noinput
|
| 27 |
|
| 28 |
COPY docker-entrypoint.sh /app/entrypoint.sh
|
| 29 |
RUN chmod +x /app/entrypoint.sh
|
|
|
|
| 22 |
OTREE_DATABASE_URL=sqlite:////data/otree.sqlite3 \
|
| 23 |
PYTHONPATH=/app
|
| 24 |
|
| 25 |
+
RUN mkdir -p /data
|
|
|
|
| 26 |
|
| 27 |
COPY docker-entrypoint.sh /app/entrypoint.sh
|
| 28 |
RUN chmod +x /app/entrypoint.sh
|
README.md
CHANGED
|
@@ -49,10 +49,9 @@ This directory packages the IBE public policy oTree demos for deployment on a Hu
|
|
| 49 |
|
| 50 |
4. **Space build & launch**
|
| 51 |
- Hugging Face automatically builds the Docker image.
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
- Launches `otree prodserver1of2 0.0.0.0:$PORT` (HF sets `$PORT`).
|
| 56 |
- The app becomes available at `https://<org>-<space-name>.hf.space/`.
|
| 57 |
|
| 58 |
## Local Verification
|
|
@@ -80,7 +79,7 @@ docker run --rm -p 8000:8000 \
|
|
| 80 |
## Notes & Customization
|
| 81 |
|
| 82 |
- **Database**: The default `OTREE_DATABASE_URL=sqlite:////data/otree.sqlite3` provides demo-ready storage but resets whenever the container restarts on Hugging Face. Point to an external Postgres instance for durable experiments.
|
| 83 |
-
- **Static assets**:
|
| 84 |
- **Session configs**: Update `settings.py` or add new apps as usual; rebuild the Space to apply changes.
|
| 85 |
- **Logging / monitoring**: Set `SENTRY_DSN`, `OTREE_PRODUCTION=1` (already set), or add custom logging handlers as desired.
|
| 86 |
|
|
|
|
| 49 |
|
| 50 |
4. **Space build & launch**
|
| 51 |
- Hugging Face automatically builds the Docker image.
|
| 52 |
+
- The container starts `/app/entrypoint.sh`, which:
|
| 53 |
+
- Creates the SQLite database at `/data/otree.sqlite3` if `OTREE_DATABASE_URL` points to SQLite.
|
| 54 |
+
- Launches `otree prodserver1of2 0.0.0.0:$PORT` (HF sets `$PORT`).
|
|
|
|
| 55 |
- The app becomes available at `https://<org>-<space-name>.hf.space/`.
|
| 56 |
|
| 57 |
## Local Verification
|
|
|
|
| 79 |
## Notes & Customization
|
| 80 |
|
| 81 |
- **Database**: The default `OTREE_DATABASE_URL=sqlite:////data/otree.sqlite3` provides demo-ready storage but resets whenever the container restarts on Hugging Face. Point to an external Postgres instance for durable experiments.
|
| 82 |
+
- **Static assets**: For lightweight deployments the built-in static files under `_static/` are served directly by oTree; add an external asset pipeline only if required.
|
| 83 |
- **Session configs**: Update `settings.py` or add new apps as usual; rebuild the Space to apply changes.
|
| 84 |
- **Logging / monitoring**: Set `SENTRY_DSN`, `OTREE_PRODUCTION=1` (already set), or add custom logging handlers as desired.
|
| 85 |
|
docker-entrypoint.sh
CHANGED
|
@@ -23,11 +23,6 @@ if [[ -n "$DB_PATH" ]]; then
|
|
| 23 |
fi
|
| 24 |
fi
|
| 25 |
|
| 26 |
-
if [[ "${SKIP_COLLECTSTATIC:-0}" != "1" ]]; then
|
| 27 |
-
log "Collecting static assets"
|
| 28 |
-
otree collectstatic --noinput
|
| 29 |
-
fi
|
| 30 |
-
|
| 31 |
PORT="${PORT:-8000}"
|
| 32 |
log "Starting oTree prodserver on 0.0.0.0:${PORT}"
|
| 33 |
exec otree prodserver1of2 0.0.0.0:${PORT}
|
|
|
|
| 23 |
fi
|
| 24 |
fi
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
PORT="${PORT:-8000}"
|
| 27 |
log "Starting oTree prodserver on 0.0.0.0:${PORT}"
|
| 28 |
exec otree prodserver1of2 0.0.0.0:${PORT}
|