Skip to main content

Shared Django runtime foundations for Baltimore civic applications

Project description

baltimore-patapsco (Python)

Reusable Django runtime primitives for Baltimore civic applications.

INSTALLED_APPS += ["baltimore.patapsco"]
MIDDLEWARE += ["baltimore.patapsco.observability.RequestContextMiddleware"]

REST_FRAMEWORK = {
    "EXCEPTION_HANDLER": "baltimore.patapsco.api.exception_handler",
}

urlpatterns = [path("", include("baltimore.patapsco.urls"))]

api_error_response() and the DRF exception handler force every 5xx response to the public internal_error code, generic message, and no details. Application callers cannot opt a server failure out of that safety boundary.

Use build_logging_config() for the shared JSON/pretty log shape. Modules are incrementally adoptable; installing the package does not enable auth, email, or Sentry by itself.

Sentry privacy defaults

Install the observability extra and call the shared initializer only when a DSN is configured:

from baltimore.patapsco.observability import configure_sentry

configure_sentry(
    environment="production",
    release="my-app@1.2.3",
    traces_sample_rate=0.1,
)

configure_sentry() is deny-by-default: it disables automatic PII, request-body capture, and stack-frame local variables. Its event pipeline also removes request cookies and query strings, strips query/fragment data from request URLs, and recursively redacts Sentry's credential/session denylist plus common civic contact and precise-location fields. Safe operational fields such as request IDs, routes, and HTTP methods remain available.

Redaction is key-based. Applications must not attach sensitive values under misleading keys or place resident data in exception messages. Product-specific fields still require a privacy review before being added to Sentry context.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baltimore_patapsco-0.1.6.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baltimore_patapsco-0.1.6-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file baltimore_patapsco-0.1.6.tar.gz.

File metadata

  • Download URL: baltimore_patapsco-0.1.6.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for baltimore_patapsco-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f69e91fe6cce6f959751f5fc2e1a35c3700a3c7f2b4b21096867980fb67a7e69
MD5 22f5d392fa16877ff93fb174419dac30
BLAKE2b-256 bb0a56727349052e4078334018a0f354feb75c44f1d2bd093e527b67710b3bcc

See more details on using hashes here.

File details

Details for the file baltimore_patapsco-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: baltimore_patapsco-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for baltimore_patapsco-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3100426d7ad78ec84b30ff9e130c87e7d9c8894f9159929967c68113dc956a6b
MD5 0f677158170c83398b12421c6a7054b5
BLAKE2b-256 d1a590c5db848d3c08c21891b05324b4869d158810d40adb5794947a6b53c063

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page