Skip to main content

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 .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
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"] }
]
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

[paths]
# URL path patterns 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

django_freakyfunkyfonts-1.3.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

django_freakyfunkyfonts-1.3.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file django_freakyfunkyfonts-1.3.0.tar.gz.

File metadata

  • Download URL: django_freakyfunkyfonts-1.3.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for django_freakyfunkyfonts-1.3.0.tar.gz
Algorithm Hash digest
SHA256 79436e938673fa941832f68ad6f86f8b541d0cde5efe1aee1e9acbfbd1a0d9ea
MD5 2f61ef9900758942cdfc9cfdee86ddea
BLAKE2b-256 051e6266b702e2626087f0906ad8b7c788af34502cf083af10fe8b6fefcca3d7

See more details on using hashes here.

File details

Details for the file django_freakyfunkyfonts-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_freakyfunkyfonts-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d8ea0b4a20596e7df86ea57df5900c90a0c70a1a7c85afb5ccdfa83adee8838
MD5 b9229dfd8d0e8e826e402cc4eed8333f
BLAKE2b-256 a4e10b0269ac97ad9226ef51b326218f565eb5e1d8f97beb98cd73e32b308986

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