django 添加comments app

简介:
安装和配置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








本文转自秋楓博客园博客,原文链接:http://www.cnblogs.com/rwxwsblog/p/5718070.html,如需转载请自行联系原作者
目录
相关文章
|
Web App开发 索引 Python
django 一个项目多个App项目搭建
django 一个项目多个App项目搭建
2314 0
|
数据库 Python 前端开发
Django的Project和App的区别
Django的Project和App的区别
1549 0
|
数据库 Python
Django setting.py添加app
在django创建app中,修改models.py添加对应的数据库表,后执行 makemigrations Mynewsite 提示: App Mynewsite could not be found.
1423 0
|
Python 测试技术 数据库
第10章节-Python3.5-Django创建App 9
# 创建app python manage.py startapp cmdb python manage.py startapp openstack python manage.
1634 0
|
Python
django 添加comments app
django 添加comments app 参看 django comments 文档 安装和配置comments 1.安装comments,运行:pip install django-contrib-comments命令 2.
644 0
|
关系型数据库 PostgreSQL 数据库管理
Writing your first Django app, part 1(转)
Let’s learn by example. Throughout this tutorial, we’ll walk you through the creation of a basic poll application.
1341 0
|
SQL 关系型数据库 数据库管理
Writing your first Django app, part 1
Let’s learn by example. Throughout this tutorial, we’ll walk you through the creation of a basic poll application. It’ll consist of two parts: A public site that lets people view polls
1663 0
|
Shell Python Windows
创建django project及app中的若干问题
1、运行djando-admin.py创建不了project??——默认编辑器的问题 因为在linux下,django-admin.py是可执行文件,所以就执行了。windows下,虽然django-admin.
1070 0
|
4天前
|
运维 监控 Serverless
Serverless 应用引擎产品使用之阿里函数计算中在自定义环境下用debian10运行django,用官方层的python3.9,配置好环境变量后发现自定义层的django找不到了如何解决
阿里云Serverless 应用引擎(SAE)提供了完整的微服务应用生命周期管理能力,包括应用部署、服务治理、开发运维、资源管理等功能,并通过扩展功能支持多环境管理、API Gateway、事件驱动等高级应用场景,帮助企业快速构建、部署、运维和扩展微服务架构,实现Serverless化的应用部署与运维模式。以下是对SAE产品使用合集的概述,包括应用管理、服务治理、开发运维、资源管理等方面。
12 3