Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cs91chris/flask_template_support
Template support for flask application
https://github.com/cs91chris/flask_template_support
flask support template
Last synced: about 1 month ago
JSON representation
Template support for flask application
- Host: GitHub
- URL: https://github.com/cs91chris/flask_template_support
- Owner: cs91chris
- License: mit
- Archived: true
- Created: 2019-04-02T22:50:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-03T00:10:46.000Z (over 3 years ago)
- Last Synced: 2024-03-15T02:13:32.734Z (8 months ago)
- Topics: flask, support, template
- Language: Python
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - cs91chris/flask_template_support - Template support for flask application (Python)
README
Flask-TemplateSupport
=====================Template support for flask application, a collection for useful extra filters and functions,
and an easy way to register them.Quickstart
~~~~~~~~~~Install ``flask_template_support`` using ``pip``:
::
$ pip install Flask-TemplateSupport
.. _section-1:
Example usage
^^^^^^^^^^^^^.. code:: python
from flask import render_template
from flask_template_support import TemplateSupportdef test_sum(a, b):
return a + bdef test_sub(a, b):
return a - bapp = Flask(__name__)
ts = TemplateSupport()ts.init_app(app, functs=(
(test_sum, 'sum'),
(test_sub, 'sub'),
))Run ``test.py`` in example folder and go to http://127.0.0.1:5000/ to see how it works
.. _section-2:
Configuration
^^^^^^^^^^^^^1. ``NOT_AVAILABLE_DESC``: *(default: N/A)* description for or_na filter
2. ``PRETTY_DATE``: *(default: %d %B %Y %I:%M:%S %p)* default date format for pretty_date filter
3. ``HUMAN_FILE_SIZE_DIVIDER``: *(default: 1000)* default divider for human_file_size filter
4. ``HUMAN_FILE_SIZE_SCALE``: *(default: ['KB', 'MB', 'GB', 'TB'])* default scale for human_file_size filterLicense MIT