Skip to main content

Utilities for working with pakk files in a flask web application.

Project description

pakk flask

Utilities for working with pakk files in a flask web application.

Getting Started

Install pakk and pakk_flask:

$ python3 -m pip install pakk pakk_flask

Then you can use pakk_flask to send pakked assets as static files in a flask web application:

from pakk_flask import send_from_directory

@APP.route("/static/<path:path>")
def get_static_file(path):
    with open("./files.pakk", "rb") as in_file:
        unpakked = unpakk(KEY, in_file)
        if unpakked.has_blob(path):
            return send_from_directory(unpakked, path)
        else:
            return send_from_directory("./static", path)

You can also use pakk_flask to render templates from pakk files:

from pakk_flask import render_template, PakkTemplate

@APP.route("/home")
def get_home_page():
    with open("./files.pakk", "rb") as in_file:
        unpakked = unpakk(KEY, in_file)
        render_template(PakkTemplate(unpakked, "index.html"),
            some_value="Hello, ",
            another_value="World!")

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

pakk_flask-2.0.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

pakk_flask-2.0.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file pakk_flask-2.0.0.tar.gz.

File metadata

  • Download URL: pakk_flask-2.0.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for pakk_flask-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1cda9a35cd0723af1c4a474fc57b594aafb973936e99c59297eaf56421275ec6
MD5 78cddaac6fae9963306f4d95459ebf02
BLAKE2b-256 6afd49c820309ac0a986cd56f341bfa5fddcd8964df402836fc90b54bb3fd515

See more details on using hashes here.

File details

Details for the file pakk_flask-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pakk_flask-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for pakk_flask-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78a8a4e99d5a4eb684b12689006af12c41b2a22e77ef65378b67a5bc82acc0b4
MD5 8adda15319a8a8ea1c335acf72197ce5
BLAKE2b-256 1afd9ce2289e7785693e88fe50bf4fb92626b16cddce385e4d1d521405d1c702

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page