Django middleware for when you want your fonts to get freaky.
Project description
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.inifor 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 .
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_freakyfunkyfonts-1.4.1.tar.gz.
File metadata
- Download URL: django_freakyfunkyfonts-1.4.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cce9b6c1a2bb2fc726382be34a5b4dd88f949e1dc2ed18aa9e17fe5d36213c03
|
|
| MD5 |
a7f72f545748e8a741eeacebb273bab6
|
|
| BLAKE2b-256 |
2e8154c9de6d9ccd9acdd4507ad7b4426f449d3acbf2851ca70309a4faf80f58
|
File details
Details for the file django_freakyfunkyfonts-1.4.1-py3-none-any.whl.
File metadata
- Download URL: django_freakyfunkyfonts-1.4.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7359cd72596291986affd7cc57b7bd906b84196ba3ffe2ada2a126d722d40907
|
|
| MD5 |
602d69fa6eb314ea09ac151c9eef14b1
|
|
| BLAKE2b-256 |
9dffea774868a1e9e82fc5bcac12fd69bdcc3f58accdb17f6c74021ad9ddcf4b
|