comments库是django框架内置的评论库,在django1.8 以后就不支持了
django1,8以后会报错
from django_comments.models import Comment
ImportError: No module named django_comments.models
需要下载安装
https://github.com/django/django-contrib-comments
python.exe setup.py install
settings 里
INSTALLED_APPS = (
'django_comments',
)
SITE_ID=1
导入:
老版本
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
新版本
from django_comments.models import Comment
from django_comments.forms import CommentForm
import django_comments
添加数据
django_comments.models.Comment.objects.create( )