Skip to main content

Flask extension that serves static file handlers in Google App Engine app.yaml files

Project description

flask-gae-static unit tests badge

Flask extension for Google App Engine that serves static file handlers from app.yaml files.

Inspired by Andreas H. Kelch's app_server project.

License: This project is placed in the public domain. You may also use it under the CC0 public domain dedication.

Usage

Install with pip install flask-gae-static. Use with eg:

from flask import Flask
import flask_gae_static

app = Flask(...)
flask_gae_static.init_app(app)
...

flask-gae-static also includes a custom URL route converter that supports regular expressions. After calling init_app(), you can use it with regex inside a variable route part, eg:

@app.route('/<regex("(abc|def)"):letters>')
def handle(letters):
  ...

Known issues

  • flask-gae-static currently only overrides Flask's built in static file support if a static handler's URL exactly matches the Flask app's static_url_path. If the static handler URL is a regexp that overlaps with it, Flask's static_url_path handling will still take precedence.

Development

After cloning the repository, set up a local virtualenv with:

python3 -m venv local
source local/bin/activate
pip install -e .

Run tests with:

python -m unittest discover

Changelog

0.2 - 2021-12-31

Add support for regexp urls and regexp replacement strings in static_files.

0.1 - 2021-12-30

Initial release.

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

flask-gae-static-0.2.tar.gz (3.8 kB view hashes)

Uploaded source

Supported by

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