Simple flask plugin to allow overriding static files
Project description
This project is a simple flask plugin to add support for overriding static files.
Dependencies:
The dependency list is therefore:
Usage:
In your flask application:
import flask from flask_multistatic import MultiStaticFlask
And replace the way you build you flask application from
APP = flask.Flask(__name__)
by
APP = MultiStaticFlask(__name__)
You can then specify multiple folder where static files are located, for example:
APP.static_folder = [ os.path.join(APP.root_path, 'static', APP.config['THEME_FOLDER']), os.path.join(APP.root_path, 'static', 'default') ]
Production:
Note that this is most likely less efficient than having apache serve the static files itself, but even if you do that you might want to have multiple static directories and have apache fallback.
In this case, you can use the example.conf file that is shipped as part of this repository.
The example.conf file has an example configuration that will try to serve a file from an instance-specific theme directory, and only if the file was not found, fall back to the application default theme.
License:
This project is licensed GPLv3+.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file flask-multistatic-1.0.tar.gz
.
File metadata
- Download URL: flask-multistatic-1.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5e9c8e451dceb18dc6343a72021c93c5fc509fdf960fa41639c98cd33289b5c |
|
MD5 | 230b3ca67ff93f0346a3b0d409006a8a |
|
BLAKE2b-256 | 6041518271e2155db6dfdcfa20cafdc53c5076b103734d7f0b20aeffdd49b165 |