Skip to main content

Flask-Collect-Invenio -- Collect static files in Flask application

Project description

Flask-Collect-Invenio is a fork and drop-in replacement of the original Flask-Collect extension with adjustments to make it compatible with Flask 2.x.

Even though serving static files with Flask is a bad idea in a production environment, this tool will help you collect them in one command. It checks application and blueprints for static files and copies them to a specific folder (saves related paths).

Version Downloads https://img.shields.io/badge/code%20style-black-000000.svg

Docs are available at http://flask-collect-invenio.readthedocs.org/. Pull requests with documentation enhancements and/or fixes are awesome and most welcome.

Requirements

  • Python 3.6+

  • Flask >= 0.10.1

Installation

Flask-Collect-Invenio should be installed using pip:

pip install Flask-Collect-Invenio

Setup

Flask-Collect-Invenio settings (default values):

# Target static dir
COLLECT_STATIC_ROOT = <APP.ROOT_PATH>/static
COLLECT_STORAGE = 'flask_collect.storage.file'

Initialize Flask-Collect-Invenio extension:

from flask_collect import Collect

...

collect = Collect()
collect.init_app(app)

If you use Flask-Script, activate Flask-Collect-Invenio commands:

from flask_collect import Collect

...
manager = Manager()
...

collect = Collect()
collect.init_app(app)
collect.init_script(manager)

If you configure Flask via a factory function:

from flask_collect import Collect

...

def create_app():
    app = Flask()
    ...
    collect = Collect()
    collect.init_app(app)

    return app

Use Flask-Collect-Invenio

From any python script:

collect.collect(verbose=True)

with Flask-Script:

$ ./manage.py collect

with Flask>=0.11:

$ flask collect

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/inveniosoftware/Flask-Collect-Invenio/issues

Contributors

Original Author: Kirill Klenov (horneds@gmail.com)

Also see the CONTRIBUTORS.rst file.

Contributing

Development of flask-collect-invenio happens at github: https://github.com/inveniosoftware/Flask-Collect-Invenio

License

Licensed under a BSD license.

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-Collect-Invenio-1.4.0.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

Flask_Collect_Invenio-1.4.0-py2.py3-none-any.whl (12.0 kB view hashes)

Uploaded Python 2 Python 3

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