This repository contains the code for the Open Humans Website.
- Docker with Compose
- uv to change Python dependencies
(
pyproject.tomlanduv.lock) - Node.js 24 and pnpm to build the CSS and JavaScript
- ChromeDriver for Selenium tests
docker compose runs the web server, the Celery worker, PostgreSQL, and
Redis. The repository is mounted into the containers, so code changes apply
without rebuilding. Rebuild after changing dependencies:
docker compose build
The sources in static/ are built into build/, which Django serves:
pnpm installpnpm build(orpnpm watchto rebuild on changes)
build.mjs bundles each script in static/js/ with esbuild, compiles the
stylesheets with Sass, and copies the third-party libraries (jQuery,
Bootstrap, select2, and others) from node_modules. The Docker image runs the
same build and collectstatic, and whitenoise serves the result.
Use env.example as a starting point. Copy this to .env and modify with your
own settings. Compose supplies DATABASE_URL and REDIS_URL itself.
Do this at the beginning, and update when pulling updated code by running:
docker compose run --rm web python manage.py migrate
For additional setup information see docs/SETUP.md.
docker compose up
The site is served at http://127.0.0.1:8000/.
docker compose run --rm -e NOBROWSER=true web python manage.py test
Tests that upload to S3 are skipped unless AWS_S3_STORAGE_BUCKET_NAME is set.
python manage.py spam_report --output-dir <dir> writes accounts.csv and
projects.csv listing accounts and unapproved projects that look like spam.
It only reads. python manage.py suspend_users --id <ids> deactivates accounts.
Please use black to format code prior to commits. Set up a
pre-commit hook by running the following:
pre-commit install