Adding Disqus Comments to Your Django Site    

Nov. 3, 2015, 2:51 p.m.

Follow Disqus' guide to get your account setup here. Note your site short name and your api key.

In your django application install django-disqus with:

        $ pip install django-disqus.

In your settings file, add disqus to your installed apps, add DISQUS_API_KEY and DISQUS_WEBSITE_SHORTNAME; the values you noted above.

In your template file (blog_post.html, for example), add the following line near the top:

        {% load disqus_tags %}

If you want to be able to post comments during testing on the django test server add this line as well:

        {% disqus_dev %}

At the end of your post, or wherever you want the comments to show, add this line:

        {% disqus_show_comments %}

to display the Disqus form. 

That's it. You're done. Now Disqus will handle authentication and comments for you post.

TAGS: Technology | All

<<<  Back

blog comments powered by Disqus