我对Django和Python都是新手,正在尝试创建博客。我的安装程序由运行在windows 10上的Django 2.0.7和python3.6.5组成。我只配置了一个名为“personal”的应用程序。在我的例子中,页面加载了“0个已发布的评论”,它不呈现评论表单。在
下面是我的代码片段
设置.py配置
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'
网址.py(网址.py在个人应用程序下)
^{pr2}$浏览量(在个人应用程序下)
def page1(request):
mycomm =Recipiecomments()
return render(request, 'personal/blackforestcake.html',locals())
最后页_详细信息.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>
删除注释表单标记周围的if标记,即
现在应该是
^{pr2}$相关问题 更多 >
编程相关推荐