Skip to main content

Jinja Materializecss theme capability

Project description

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 %}

Project details


Download files

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

Files for justengel-material, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size justengel_material-0.0.3-py3-none-any.whl (263.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size justengel_material-0.0.3.tar.gz (255.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page