参看 django comments 文档

安装和配置comments

1.安装comments,运行:pip install django-contrib-comments命令

2.settings.py中做如下操作:

  • INSTALLED_APPS下添加'django.contrib.sites'
  • INSTALLED_APPS下添加'django_comments'
  • 定义SITE_ID , SITE_ID = 1

3.令comments app生效

django-admin migrate

4.配置url

  • 修改url.py添加comment app url
urlpatterns = [
    ...
    url(r'^comments/', include('django_comments.urls')),
    ...
]

5.生成comments表

python manage.py migrate

(blog) [root@localhost blog]# python manage.py migrate

Operations to perform:
  Apply all migrations: admin, django_comments, blogpost, sessions, sites, auth, contenttypes
Running migrations:
  Rendering model states... DONE
  Applying sites.0001_initial... OK
  Applying django_comments.0001_initial... OK
  Applying django_comments.0002_update_user_email_field_length... OK
  Applying django_comments.0003_add_submit_date_index... OK
  Applying sites.0002_alter_domain_unique... OK

相关文章:

  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
  • 2021-10-11
  • 2021-09-09
  • 2021-07-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-06-18
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案