Skip to main content

Fastapi Jinja materializecss theming system.

Example

# material_demo.py
import os
from fastapi import FastAPI, Request
import justengel_material

MY_DIR = os.path.dirname(__file__)

app = FastAPI()
material = justengel_material.MaterialTemplates(os.path.join(MY_DIR, 'templates'))
material.install_app(app, site_name='Material Demo', primary_color='purple', secondary_color='teal')

@app.get('/')
def index(request: Request):
    ctx = {'request': request, 'base_url': request.base_url,
           'title': 'index'
           }
    return material.TemplateResponse('material/index.html', ctx)

HTML Template in templates/material/index.html

{# templates/material/index.html #}
{% extends "justengel_material/base.html" %}

{% block contents %}
<h1>Hello World!</h1>

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
</ul>

<button class="btn">Button</button>
{% endblock contents %}

Release files for justengel-material 1.0.5

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

Source distribution (sdist)

Source distribution for justengel-material 1.0.5
File Size Uploaded
justengel_material-1.0.5.tar.gz 257.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for justengel-material 1.0.5
File Interpreter ABI Platform
justengel_material-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 524.3 kB

Release files / justengel_material-1.0.5.tar.gz

Download URL justengel_material-1.0.5.tar.gz
Size 257.6 kB
Tags Source
SHA-256 checksum
How to use checksums
279d04d9371b937a04818cfac3c40b490ed57883a2f27bb2c483786192052c3d
BLAKE2b-256 checksum
How to use checksums
9141f44b43a59fe89af258eb0f5dd40ca670f05fd0b7f2ccff49dbce24511b6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.7

Release files / justengel_material-1.0.5-py3-none-any.whl

Download URL justengel_material-1.0.5-py3-none-any.whl
Size 266.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44cacf24d3341e15505ab7f7ea154bdaa7467ec22721e0c7d61d07ec551d6014
BLAKE2b-256 checksum
How to use checksums
cf5e33327d72ecc2327cda92f25c86787432f04ed47384889a0dc704c01406d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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