Skip to main content

Freaky Funky Fonts Middleware (Django)

For when you feel the funk that freaks you fonts

What it this?

Freaky Funky Fonts Middleware is essentially a Django “font chaos” middleware package with configurable behaviour.

It intercespts the html of Djangos reponses, and applies random fonts to each and every peice of text in html documents.

Usage

  • Install the package.
  • Apply the middleare in your Django project settings as middleware.
  • (Optional but recommended) Configure in your freakyfunkyfonts.toml (or .ini for versions before python 3.11).

Installing

pip install django-freakyfunkyfonts

Applying

In the project settings

MIDDLEWARE = [
    # ...
    "freakyfunkyfonts.middleware.FreakyFunkyFontsMiddleware",
]

Configs

Example:

[fonts]
# List of fonts to randomly pick from
pool = [
  "Times New Roman",
  "Georgia",
  "Merriweather",
  "Lora"
]

[inject]
# Extra tags to inject into <head> (Like a link tag to google fonts)
# More than one tag can be applied, just append to the list
# Make sure that the fonts in the pool are convered
tags = [
  '<link href="https://fonts.googleapis.com/css2?family=Merriweather&family=Lora&display=swap" rel="stylesheet">'
]

[behaviour]
# Scopes to operate on: "all" (If it should work on the whole html document), "body", or any tag names (article, main)
scopes = ["body", "article", "main"]

# HTML tags to skip completely
skip_tags = ['head', 'title', 'meta', 'link', 'style', 'script'] 

[date_ranges]
# List of date ranges with optional time ranges
# You can use full dates (YYYY-MM-DD:YYYY-MM-DD) or year-agnostic month-day ranges (MM-DD:MM-DD)
# A range "2025-12-24:2025-12-26" will apply on December 24, 25, and 26. 
# The same applies to month-day ranges like "12-24:12-26".
include = [
  { range = "2025-10-01:2025-10-10", temporal = ["08:00-18:00"] },
  { range = "2025-12-24:2025-12-26", temporal = ["00:00-23:59"] },
  { range = "12-24:12-26", temporal = ["00:00-23:59"] } # applies every year
]
exclude = [
  { range = "2025-12-31:2026-01-01", temporal = ["00:00-23:59"] }
]

# The middleware will only apply during the included date/time ranges, and will be skipped during excluded ranges.
# If no temporal is specified, the range applies for the whole day
# If no ranges are defined, the middleware is always applied
# You can use MM-DD:MM-DD for recurring yearly ranges.

[paths]
# URL path patterns (RegEx) to include or exclude
include = ["^/funky/", "^/blog/"]
exclude = ["^/admin/", "^/api/"]

# The middleware will only apply to included paths and will be skipped for excluded paths.
# If no paths are defined, the middleware is applied to all URLs.

Dev

Installing

pip install -e .

Metadata

Release files for django-freakyfunkyfonts 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-freakyfunkyfonts 1.4.1
File Size Uploaded
django_freakyfunkyfonts-1.4.1.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-freakyfunkyfonts 1.4.1
File Interpreter ABI Platform
django_freakyfunkyfonts-1.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / django_freakyfunkyfonts-1.4.1.tar.gz

Download URL django_freakyfunkyfonts-1.4.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cce9b6c1a2bb2fc726382be34a5b4dd88f949e1dc2ed18aa9e17fe5d36213c03
BLAKE2b-256 checksum
How to use checksums
2e8154c9de6d9ccd9acdd4507ad7b4426f449d3acbf2851ca70309a4faf80f58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / django_freakyfunkyfonts-1.4.1-py3-none-any.whl

Download URL django_freakyfunkyfonts-1.4.1-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7359cd72596291986affd7cc57b7bd906b84196ba3ffe2ada2a126d722d40907
BLAKE2b-256 checksum
How to use checksums
9dffea774868a1e9e82fc5bcac12fd69bdcc3f58accdb17f6c74021ad9ddcf4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

1.4.1 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.1.3

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page