Skip to content

inveniosoftware/flask-collect-invenio

Repository files navigation

Flask-Collect-Invenio

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

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

  • Python 3.6+
  • Flask >= 0.10.1

Flask-Collect-Invenio should be installed using pip:

pip install Flask-Collect-Invenio

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

From any python script:

collect.collect(verbose=True)

with Flask-Script:

$ ./manage.py collect

with Flask>=0.11:

$ flask collect

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

Original Author: Kirill Klenov ([email protected])

Also see the CONTRIBUTORS.rst file.

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

Licensed under a BSD license.

About

Drop-in replacement of Flask-Collect with support for Flask 2.x.

Resources

License

Stars

Watchers

Forks

Packages

No packages published