New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flask-multistatic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flask-multistatic

Simple flask plugin to allow overriding static files

  • 1.0
  • PyPI
  • Socket score

Maintainers
1

flask-multistatic

:Author: Pierre-Yves Chibon pingou@pingoured.fr

This project is a simple flask_ plugin to add support for overriding static files.

Dependencies:

.. _python: http://www.python.org .. _Flask: http://flask.pocoo.org/

The dependency list is therefore:

  • python_ (2.5 minimum)
  • flask_

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')
]

.. note:: The order of the folder is important, the last folder should be the one where most files are present, the other folders are where you override the static files. So in the example above, all the default static files are in /static/default/ and the files specific for one theme are under /static/<theme_name>/.

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+.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc