flask-gae-static


Nameflask-gae-static JSON
Version 1.0 PyPI version JSON
download
home_pagehttps://github.com/snarfed/flask-gae-static
SummaryFlask extension that serves static file handlers in Google App Engine app.yaml files
upload_time2022-08-09 15:11:35
maintainer
docs_urlNone
authorRyan Barrett
requires_python>=3.6
licensePublic domain
keywords flask app engine google app engine app.yaml static files directories
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            flask-gae-static ![unit tests badge](https://github.com/snarfed/flask-gae-static/actions/workflows/unit-tests.yml/badge.svg)
===

[Flask](https://flask.palletsprojects.com/) extension for [Google App Engine](https://cloud.google.com/appengine/) that serves static file handlers from [`app.yaml` files](https://cloud.google.com/appengine/docs/standard/python3/config/appref).

App Engine's built in static file serving is better in most ways than serving static files via app code: it uses Google Cloud's CDN, which is generally faster, cheaper, more scalable, and more secure. However, App Engine's [`dev_appserver` local server](https://cloud.google.com/appengine/docs/standard/python3/testing-and-deploying-your-app#local-dev-server) is [deprecated](https://cloud.google.com/appengine/docs/standard/python3/testing-and-deploying-your-app) and [degrading](https://issuetracker.google.com/issues?q=%22dev_appserver%22), and Google hasn't provided a replacement for local development that supports `app.yaml`-based static file handlers. This extension fills that gap.

Inspired by [Andreas H. Kelch](https://github.com/XeoN-GHMB)'s [app_server](https://github.com/XeoN-GHMB/app_server) project.

License: This project is placed in the public domain. You may also use it under the [CC0 public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).


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

```py
from flask import Flask
import flask_gae_static

app = Flask(..., static_folder=None)
flask_gae_static.init_app(app)
...
```

(`static_folder=None` is required to disable Flask's [built in static file handling](https://flask.palletsprojects.com/en/2.2.x/tutorial/static/) so that flask-gae-static can handle static files under any URL path prefix.)

flask-gae-static also includes a custom [URL route converter](https://flask.palletsprojects.com/en/2.0.x/api/#url-route-registrations) that supports regular expressions. After calling `init_app()`, you can use it with `regex` inside a variable route part, eg:

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


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

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

Run tests with:

```py
python -m unittest discover
```


Changelog
---
### 1.0 - 2021-08-09

**Breaking changes**

Require the `Flask` app to be constructed with `static_folder=None`.

Before this, flask-gae-static tried to disable Flask's static file handling itself, but since it couldn't control the `Flask` initialization, it had to resort to workarounds that depended on Flask and werkzeug internal implementation details, and it broke when those details changed. This avoids that.

### 0.2 - 2021-12-31

Add support for regexp `url`s and regexp replacement strings in `static_files`.

### 0.1 - 2021-12-30

Initial release.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/snarfed/flask-gae-static",
    "name": "flask-gae-static",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "flask,App Engine,Google App Engine,app.yaml,static,files,directories",
    "author": "Ryan Barrett",
    "author_email": "flask-gae-static@ryanb.org",
    "download_url": "https://files.pythonhosted.org/packages/b7/b3/7237e42f2427232eacb8558e74ea7d86cbde98786868f2ce1cb8c9e53e5c/flask-gae-static-1.0.tar.gz",
    "platform": null,
    "description": "flask-gae-static ![unit tests badge](https://github.com/snarfed/flask-gae-static/actions/workflows/unit-tests.yml/badge.svg)\n===\n\n[Flask](https://flask.palletsprojects.com/) extension for [Google App Engine](https://cloud.google.com/appengine/) that serves static file handlers from [`app.yaml` files](https://cloud.google.com/appengine/docs/standard/python3/config/appref).\n\nApp Engine's built in static file serving is better in most ways than serving static files via app code: it uses Google Cloud's CDN, which is generally faster, cheaper, more scalable, and more secure. However, App Engine's [`dev_appserver` local server](https://cloud.google.com/appengine/docs/standard/python3/testing-and-deploying-your-app#local-dev-server) is [deprecated](https://cloud.google.com/appengine/docs/standard/python3/testing-and-deploying-your-app) and [degrading](https://issuetracker.google.com/issues?q=%22dev_appserver%22), and Google hasn't provided a replacement for local development that supports `app.yaml`-based static file handlers. This extension fills that gap.\n\nInspired by [Andreas H. Kelch](https://github.com/XeoN-GHMB)'s [app_server](https://github.com/XeoN-GHMB/app_server) project.\n\nLicense: This project is placed in the public domain. You may also use it under the [CC0 public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).\n\n\nUsage\n---\nInstall with `pip install flask-gae-static`. Use with eg:\n\n```py\nfrom flask import Flask\nimport flask_gae_static\n\napp = Flask(..., static_folder=None)\nflask_gae_static.init_app(app)\n...\n```\n\n(`static_folder=None` is required to disable Flask's [built in static file handling](https://flask.palletsprojects.com/en/2.2.x/tutorial/static/) so that flask-gae-static can handle static files under any URL path prefix.)\n\nflask-gae-static also includes a custom [URL route converter](https://flask.palletsprojects.com/en/2.0.x/api/#url-route-registrations) that supports regular expressions. After calling `init_app()`, you can use it with `regex` inside a variable route part, eg:\n\n```py\n@app.route('/<regex(\"(abc|def)\"):letters>')\ndef handle(letters):\n  ...\n```\n\n\nDevelopment\n---\nAfter cloning the repository, set up a local virtualenv with:\n\n```py\npython3 -m venv local\nsource local/bin/activate\npip install -e .\n```\n\nRun tests with:\n\n```py\npython -m unittest discover\n```\n\n\nChangelog\n---\n### 1.0 - 2021-08-09\n\n**Breaking changes**\n\nRequire the `Flask` app to be constructed with `static_folder=None`.\n\nBefore this, flask-gae-static tried to disable Flask's static file handling itself, but since it couldn't control the `Flask` initialization, it had to resort to workarounds that depended on Flask and werkzeug internal implementation details, and it broke when those details changed. This avoids that.\n\n### 0.2 - 2021-12-31\n\nAdd support for regexp `url`s and regexp replacement strings in `static_files`.\n\n### 0.1 - 2021-12-30\n\nInitial release.\n\n\n",
    "bugtrack_url": null,
    "license": "Public domain",
    "summary": "Flask extension that serves static file handlers in Google App Engine app.yaml files",
    "version": "1.0",
    "split_keywords": [
        "flask",
        "app engine",
        "google app engine",
        "app.yaml",
        "static",
        "files",
        "directories"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "a72041bf0e76cab5d2e224c22a4cbf8c",
                "sha256": "a392387ad27913830139b13269f43bcd8f92e4663fe7c5c2d7076dbe6df8f6fc"
            },
            "downloads": -1,
            "filename": "flask-gae-static-1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a72041bf0e76cab5d2e224c22a4cbf8c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4285,
            "upload_time": "2022-08-09T15:11:35",
            "upload_time_iso_8601": "2022-08-09T15:11:35.646221Z",
            "url": "https://files.pythonhosted.org/packages/b7/b3/7237e42f2427232eacb8558e74ea7d86cbde98786868f2ce1cb8c9e53e5c/flask-gae-static-1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-09 15:11:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "snarfed",
    "github_project": "flask-gae-static",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flask-gae-static"
}
        
Elapsed time: 0.01632s