No description
  • Python 54.8%
  • HTML 39.4%
  • JavaScript 4.9%
  • CSS 0.9%
Find a file
2026-10-27 15:04:26 +01:00
app Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
data Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
tests Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
.gitignore Serve a base64 copy of the code for offline installs 2026-10-27 15:04:26 +01:00
manage.py Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
package-lock.json Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
package.json Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
README.md Serve a base64 copy of the code for offline installs 2026-10-27 15:04:26 +01:00
requirements-dev.txt Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
requirements.txt Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
serve.sh Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00
TRANSLATION.md Swift Running Club website: Python translation of the PHP/Oracle site 2026-10-27 14:07:48 +01:00

Swift Running Club — website (Python translation)

A faithful translation of the legacy PHP/Oracle site to Python (FastAPI + Jinja2) with a SQLite database and a Tailwind CSS restyling. Pages, forms, rules and texts are those of the PHP site; URLs are clean ones (/results/championship, /my-running/races/add, …) and every legacy URL (/Results/ChampionshipPointsTable.php, with or without .php) redirects permanently to its new one (table in app/urls.py); see TRANSLATION.md for how each PHP construct was translated.

Run it

python3 -m venv .venv
.venv/bin/pip install -r requirements.txt -r requirements-dev.txt

# Database: same tables/columns/views as the Oracle schema, loaded with the legacy SQLite export
.venv/bin/python manage.py import-legacy path/to/Running_essential/DATA/SRC.db     # or: manage.py init

SRC_SECRET_KEY=change-me SRC_ADMIN_PASSWORD=choose-one .venv/bin/uvicorn app.main:app

Open http://localhost:8000 (the home page).

CSS: app/static/css/app.css is built from app/static/css/input.css (npm install && npm run build:css, or npm run watch:css while editing templates).

Tests: .venv/bin/python -m pytest -q (they load the legacy export from data/legacy/SRC.db, or SRC_LEGACY_DB; without it they use a copy of data/src.db)

Configuration

Variable Meaning
SRC_SECRET_KEY Signs the session cookie (set it, otherwise sessions are lost on restart).
SRC_DB SQLite file (default data/src.db).
SRC_ADMIN_USER / SRC_ADMIN_PASSWORD HTTP Basic credentials protecting /Restricted/... (the PHP relied on the web server for this). Without a password, Restricted is refused unless SRC_DEV=1.
SRC_ADMIN_EMAILS Optional allow-list for SRCCredIsAdmin() (disabled in the PHP, so empty by default).
SRC_SMTP_HOST, SRC_SMTP_PORT, SRC_SMTP_TLS, SRC_SMTP_USER, SRC_SMTP_PASSWORD Mail sending (the Oracle UTL_MAIL procedures). Without a host, mails are printed in the server log.
SRC_DATA_DIR Where the text files written by the legacy pages go (Registrations.txt, …). Default data/.
SRC_HTTPS=1 Secure session cookie behind HTTPS.

Layout

app/
  main.py        app, sessions, routers
  urls.py        legacy URL -> clean URL table + the redirect middleware
  db.py          SQLite access (rows = dicts with lower-case Oracle column names), secs()/regexp_replace() SQL functions
  schema.sql     tables and views translated from the Oracle SRC schema
  src.py         INC/Header.php helpers, PerfPoints.php, RefundCapsRatios.php, SubmitLimit.php
  cred.py        INC/Cred.php (login by picking a member, as before) + Restricted protection
  mail.py        Oracle mail procedures / triggers
  web.py         rendering helpers (SRCWriteHeader/Footer)
  routes/        one module per legacy folder group: home (Home, Info, News, Media), calendar, results,
                 myrunning, restricted, yearly (YearlyEvent, YearlyTrip, Brussels20k)
  templates/     one folder per legacy folder; partials/ = INC/DivNavLeft*.php
  static/        css, js (SRCscripts.js and sorttable.js copied as is), img, legacy/ (drop the old IMG/PDF files here)
manage.py        init / import-legacy
tests/

Offline copy (base64)

https://<site>/static/dist/src-club.tgz.b64.txt is the current commit as a base64 tar.gz, to paste into a machine that has pip but no other way to receive files. Regenerate it after a commit:

git archive --format=tar.gz --prefix=src-club/ -9 HEAD | base64 -w 76 > app/static/dist/src-club.tgz.b64.txt

On the target: base64 -d src-club.tgz.b64.txt | tar xz, then install as above. The database is not included (it holds member data).