I am new to both Django and Python and am trying to create my blog.My setup consists of Django 2.0.7 and Python 3.6.5 running on windows 10.I have configured only one app named "personal".In my case the the page loads with "0 Comments Posted" and it doesn't renders the comment form.
Below is my code snippet
settings.py config
INSTALLED_APPS = [
'personal',
'django.contrib.sites',
'django_comments_xtd',
'django_comments',
]
COMMENTS_APP = "django_comments_xtd"
COMMENTS_XTD_CONFIRM_EMAIL = True
COMMENTS_XTD_SALT = b"es-war-einmal-una-bella-princesa-in-a-beautiful-castle"
COMMENTS_XTD_FROM_EMAIL = 'noreply@example.com'
COMMENTS_XTD_CONTACT_EMAIL = 'helpdesk@example.com'
COMMENTS_XTD_MAX_THREAD_LEVEL = 0
COMMENTS_XTD_THREADED_EMAILS = False
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.mail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'noreply@example.com'
EMAIL_HOST_PASSWORD = 'abcd1234'
urls.py (urls.py under personal app)
urlpatterns = [
........................
........................
url(r'^comments/', include('django_comments_xtd.urls')),
]
models.py (under personal app)
from django.db import models
class mycomments(models.Model):
mail = models.CharField(max_length = 50)
name = models.CharField(max_length = 50)
phonenumber = models.IntegerField()
class Meta:
db_table = "mycomments"
views (under personal app)
def page1(request):
mycomm =Recipiecomments()
return render(request, 'personal/blackforestcake.html',locals())
And Finally page_detail.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My Page</title>
{% load static %}
</head>
<body>
<div class="fh5co-loader"></div>
<div id="page">
{% include 'personal/head.html' %}
{% load comments %}
{% load comments_xtd %}
<div id="fh5co-author">
<div class="container">
<div class="row top-line animate-box">
<div class="col-md-8 col-md-offset-2">
<h2>My Blog detail</h2>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<p class="animate-box"><img src="{% static "personal/img/pic" %}" class="img-responsive" alt="image"></p>
<div class="testimony animate-box">
<blockquote>
<h3>Topic 1:</h3>
<ul>
<li>Detail 1</li>
</ul>
</blockquote>
</div>
{% get_comment_count for mycomm as comment_count %}
⋅
{{ comment_count }} comments have been posted.
</div>
{% if mycomm.allow_comments %}
<div class="comment">
<h4 class="text-center">Your comment</h4>
<div class="well">
{% render_comment_form for mycomm %}
</div>
</div>
{% endif %}
{% if comment_count %}
<hr/>
<ul class="media-list">
{% render_xtdcomment_tree for mycomm %}
</ul>
{% endif %}
</div>
<div class="gototop js-top">
<a href="#" class="js-gotop"><i class="icon-arrow-up"></i></a>
</div>
</body>
</html>