Repository navigation
Modernize the members map and fix blocked map tiles - #1
Merged
Merged
Conversation
OpenStreetMap blocks tile requests without a Referer. folium 0.7 rendered the map into a data: URL iframe, which has no origin, so tiles were refused. The map is now drawn with Leaflet directly in the page, using the current https://tile.openstreetmap.org URL and a Referrer-Policy that sends our origin. - Python 3.14 with uv (pyproject.toml, uv.lock, .python-version) for the heroku-26 stack; Flask 3, psycopg 3, geopy 2, gunicorn - members_map package with an app factory, typed DB helpers and an init-db command run in the Heroku release phase - Marker clustering, nicknames as hover tooltips, responsive layout - Input validation and a clear message when geocoding is unavailable - /export/json requires EXPORT_PASSWORD (basic auth), 404 when unset - pytest suite against Postgres, ruff, GitHub Actions CI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WLRZ1bCeX4qyg1QpD6AQFG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Dan · project thread
Why
Map tiles on https://members-map.realpython.com show OpenStreetMap's "403 Access blocked" image. folium 0.7 rendered the map into an iframe whose
srcis a base64data:URL. That document has no origin, so the browser sends tile requests without aReferer, which the OSM tile usage policy now enforces. The app also ran Python 3.7 on heroku-20, which can no longer build.What
https://tile.openstreetmap.org/{z}/{x}/{y}.pngandReferrer-Policy: strict-origin-when-cross-origin. Pins are clustered and nicknames appear as hover tooltips (1,067 permanent labels were unreadable). Nicknames are inserted as text, not HTML.pyproject.toml,uv.lock,.python-version) for the heroku-26 stack. Flask 3, psycopg 3, geopy 2, gunicorn. folium and numpy are gone.members_map/package with an app factory, small DB layer, andflask --app members_map init-db(CREATE TABLE IF NOT EXISTS, run in the Heroku release phase, a no-op on the existing table)./export/jsonused to hand all data to anyone. It now needsEXPORT_PASSWORDvia HTTP basic auth and returns 404 when the variable is unset. The JSON shape is unchanged./hello,/map(rendered an empty map), Windows Procfile, dead DB helpers.Testing
uv run pytest: 14 passed.ruff checkandruff format --checkare clean.Deploy notes
SECRET_KEYshould already be set. If it's missing, the app falls back to a random per-process key.EXPORT_PASSWORDonly if the export is still needed.Generated by Claude Code