Django Installation
Add Simple Commenter to your Django application by adding the script to your base template.
Important: The domain in your script must exactly match the domain you registered in your Simple Commenter dashboard. If they don't match, the widget won't load.
Basic Installation
Add the script to your base template that other templates extend:
<!-- templates/base.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}My Django App{% endblock %}</title>
{% block extra_head %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
<!-- Add Simple Commenter before closing body -->
<script
src="https://simplecommenter.com/js/comments.min.js"
data-domain="your-domain.com"
defer
></script>
</body>
</html>
Replace your-domain.com with your actual domain from the Simple Commenter dashboard.
Using Django Settings
Store the domain in your settings for easier management:
# settings.py
SIMPLE_COMMENTER_DOMAIN = "your-domain.com"
Create a context processor:
# myapp/context_processors.py
from django.conf import settings
def simple_commenter(request):
return {
'simple_commenter_domain': getattr(settings, 'SIMPLE_COMMENTER_DOMAIN', '')
}
Add to settings:
# settings.py
TEMPLATES = [
{
'OPTIONS': {
'context_processors': [
# ... other processors
'myapp.context_processors.simple_commenter',
],
},
},
]
Use in template:
<!-- templates/base.html -->
{% if simple_commenter_domain %}
<script
src="https://simplecommenter.com/js/comments.min.js"
data-domain="{{ simple_commenter_domain }}"
defer
></script>
{% endif %}
Environment-Based Configuration
Use environment variables for different environments:
# settings.py
import os
SIMPLE_COMMENTER_DOMAIN = os.environ.get('SIMPLE_COMMENTER_DOMAIN', '')
# .env or environment
SIMPLE_COMMENTER_DOMAIN=your-domain.com
Conditional Loading
Only load on certain views or conditions:
<!-- templates/base.html -->
{% if show_feedback_widget %}
<script
src="https://simplecommenter.com/js/comments.min.js"
data-domain="your-domain.com"
defer
></script>
{% endif %}
In your view:
# views.py
def my_view(request):
return render(request, 'my_template.html', {
'show_feedback_widget': True # or some condition
})
Page-Specific Widget
To only add to specific pages, use template blocks:
<!-- templates/base.html -->
{% block extra_scripts %}{% endblock %}
</body>
<!-- templates/feedback_page.html -->
{% extends "base.html" %}
{% block extra_scripts %}
<script
src="https://simplecommenter.com/js/comments.min.js"
data-domain="your-domain.com"
defer
></script>
{% endblock %}
Django REST Framework / API-Only
If your Django app is API-only with a separate frontend, add the script to your frontend instead. See the React, Vue, or General Installation guides.
Verifying Installation
- Run your development server (
python manage.py runserver) - Open your app in the browser
- Look for the feedback widget button
- Check browser console (F12) for errors
- Verify across different pages
Troubleshooting
Widget not appearing
- Check that your template extends the base template correctly
- Verify the domain matches your dashboard settings
- Inspect the page source to confirm the script tag is present
- Look for JavaScript errors in browser console
Template inheritance issues
- Ensure
{% extends "base.html" %}is at the top of child templates - Check that the script is outside any blocks that might be overridden
Static files / Production
In production:
- The script is hosted externally, so Django's static files settings don't affect it
- Ensure your production domain is registered in your dashboard
- Consider using different domains for staging vs production
Admin panel
The widget will appear in the Django admin by default if using the same base template. To exclude:
{% if not request.path|slice:":7" == "/admin/" %}
<script ...></script>
{% endif %}
Need help? Contact support.