zoukankan      html  css  js  c++  java
  • django 添加comments app

    django 添加comments app

    参看 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
    
  • 相关阅读:
    swift制作framework过程
    Redis学习
    Mysql vs NoSql vs NewSql
    Mysql实践
    跨库分页解决方案[转]
    二分查找解题套路框架 [转]
    Service Mesh [转]
    Golang Case
    [转]分布式服务限流
    保险
  • 原文地址:https://www.cnblogs.com/rwxwsblog/p/5718070.html
Copyright © 2011-2022 走看看