Skip to main content

Flask extension to add a nice blog to your website

Project description

Canonical blog extension

This extension allows you to add a simple frontend section to your flask app. All the articles are pulled from Canonical's Wordpress back-end through the JSON API.

This extension provides a blueprint with 3 routes:

  • "/": that returns the list of articles
  • "/<slug>": the article page
  • "/feed": provides a RSS feed for the page.

How to install

To install this extension as a requirement in your project, you can use PIP;

pip install

See also the documentation for (pip install)[].

How to use


The module expects HTML templates at blog/index.html, blog/article.html, blog/blog-card.html, blog/archives.html, blog/upcoming.html and blog/author.html.

An example of these templates can be found at


In your app you can then:

    import flask
    from import BlogViews
    from import build_blueprint

    app = flask.Flask(__name__)

    # ...

    blog_views = BlogViews()
    app.register_blueprint(build_blueprint(blog_views), url_prefix="/blog")

You can customise the blog through the following optional arguments:

    blog_views = BlogViews(
        tag_ids=[1, 12, 112],
        exclude_tags=[26, 34],
        feed_description="The Ubuntu Blog Feed",
        per_page=12, # OPTIONAL (defaults to 12)
    app.register_blueprint(build_blueprint(blog_views), url_prefix="/blog")


The blog extension leverages poetry for dependency management.


poetry install
poetry run poetry-setup


All tests can be run with poetry run pytest.

Regenerating Fixtures

All API calls are caught with VCR and saved as fixtures in the fixtures directory. If the API updates, all fixtures can easily be updated by just removing the fixtures directory and rerunning the tests.

To do this run rm -rf fixtures && poetry run pytest.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for, version 5.0.0
Filename, size File type Python version Upload date Hashes
Filename, size (10.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size (10.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page