使用第三方django-contrib-comments实现文章评论功能

1. Install the comments app

# shell
pip install django-contrib-comments

2. Make migrations

# shell
python3 manage.py makemigrations
python3 manage.py migrate

3. Install the comments framework by adding django_comments to INSTALLED_APPS

# settings.py
INSTALLED_APPS = [
	"taggit",
	"markdownx",
	"django_comments"
]

4. Add the comment app’s URLs to your project’s urls.py

# urls.py
urlpatterns = [
	# ...
	path("comments/", include("django_comments.urls")),
]

5. Load the comment template tags in your template’s file

# html
{% load comments %}
发布了70 篇原创文章 · 获赞 45 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_38727847/article/details/104340154