Django Installation
Add Simple Commenter to your Django application by adding the script to your base template.
Important: The public key in your script must match a project in your Simple Commenter dashboard. If it doesn'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?id=sc_your_public_key"
defer
></script>
</body>
</html>
Replace sc_your_public_key with your project's public key from the Simple Commenter dashboard.
Using Django Settings
Store the public key in your settings for easier management:
# settings.py
SIMPLE_COMMENTER_KEY = "sc_your_public_key"
Create a context processor:
# myapp/context_processors.py
from django.conf import settings
def simple_commenter(request):
return {
'simple_commenter_key': getattr(settings, 'SIMPLE_COMMENTER_KEY', '')
}
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_key %}
<script
src="https://simplecommenter.com/js/comments.min.js?id={{ simple_commenter_key }}"
defer
></script>
{% endif %}
Environment-Based Configuration
Use environment variables for different environments:
# settings.py
import os
SIMPLE_COMMENTER_KEY = os.environ.get('SIMPLE_COMMENTER_KEY', '')
# .env or environment
SIMPLE_COMMENTER_KEY=sc_your_public_key
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?id=sc_your_public_key"
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?id=sc_your_public_key"
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 public key 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.