Open In App

Integrating Facebook Comments Plugin in Django Project

Last Updated : 23 Nov, 2021
Like Article

Django is a Python-based web framework that allows you to quickly create efficient web applications. It is also called batteries included framework because Django provides built-in features for everything including Django Admin Interface, default database – SQLlite3, etc.  In this article, we will learn to integrate the Facebook comment plugin in Django.

How to integrate facebook comments plugin?

First, we have to install Django. Open cmd or terminal 

pip install django

To create a new Django project –

django-admin startproject fbcomm

Then write command –

cd fbcomm

create a new app – 

python startapp main

Folder Structure:-

Then add the app name in INSTALLED_APPS in .

fbcomm/ :-


from django.contrib import admin
from django.urls import path,include
urlpatterns = [


from django.shortcuts import render
# Create your views here.
def home(request):
    return render(request,'main/index.html')

Then create the new file in the main folder and name it


from django.urls import path
from .views import *
urlpatterns = [

Go to the Facebook comment plugin link and get the code of the comment plugin

Click on get code and copy that code 

Inside main create the folder templates inside create another main folder

Then create the file and name it index.html


<script async defer crossorigin="anonymous"
    <h1>Facebook Comment Plugin</h1>
    <div class="fb-comments" data-href=""
         data-width="" data-numposts="5"></div>

To run Django app open cmd or terminal and write command 

python runserver


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads