Skip to main content

Comment system integration for Flask applications

Project description

Flask-Discussion

Documentation Status

Flask-Discussion is an extension for Flask that adds support for several discussion/comment systems to your application.

Supported comment systems:

Quickstart

First install the extension:

pip install Flask-Discussion

And then initialize it in your application:

from flask import Flask
from flask_discussion import Discussion

discussion = Discussion()

def init_app():
    app = Flask(__name__)

    # Set config values
    # .....

    discussion.init_app(app)

This will register the extension templates (which contain the macros for each comment system) with your application, making them available in your own templates.

If you want to be able to swap comment systems through the configuration of your application, you may use the macro defined in flask_discussion/helper.html:

{% import "flask_discussion/helper.html" as discussion %}

<html>
    <body>
        {{ discussion.render_comments(title="Page title", identifier="my-page", url="http://mypage.com") }}
    </body>
</html>

Note that the macro receives any keyword argument and will relay the appropriate information to the corresponding system-specific macro (i.e. each comment system may use only specific information, therefore you should provide all possible values for all comment systems).

However, if you only want to use a specific comment system, you may import its macros directly. For instance, for Disqus:

{% import "flask_discussion/disqus.html" as disqus %}

<html>
    <body>
        {{ disqus.render_comments(identifier="my-page", url="http://mypage.com", title="Page title") }}
    </body>
</html>

Documentation

Documentation is available at https://flask-discussion.readthedocs.io.

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-Discussion-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

Flask_Discussion-0.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file Flask-Discussion-0.1.1.tar.gz.

File metadata

  • Download URL: Flask-Discussion-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5rc1

File hashes

Hashes for Flask-Discussion-0.1.1.tar.gz
Algorithm Hash digest
SHA256 58fdeab7faf19598e458ac48dceea1e9eaa0fa64c63fc8ec1b543c5aed46bbeb
MD5 f25d3efd8498b92feae68cbda6d1147b
BLAKE2b-256 ae3cd0dcffdd0f8b7f51dc5c47a73eace783be8f39b19a99b92f16ac46e9eadd

See more details on using hashes here.

File details

Details for the file Flask_Discussion-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: Flask_Discussion-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5rc1

File hashes

Hashes for Flask_Discussion-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8fc8873f0dfa81340d60655854eb9e6078bb9fa6e4db072fbd4aac7d5a88c99e
MD5 41a8335875f6147f1422af08d1e1c752
BLAKE2b-256 4c6a1619581d831b3bd3eb161f3a28cba867af5fdb9859b499881d34f90f2121

See more details on using hashes here.

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