python - 如何在Django-1.9中添加Redis数据库?

标签 python django redis django-settings django-redis

我想在Django-1.9中添加Redis数据库,所以我按照这个文档进行了集成 https://niwinz.github.io/django-redis/latest/ 但是我没有找到任何关于如何在设置中提及数据库名称的线索,在这里我想代表 Sqlite3 将 Redis 作为数据库提及,如果取消注释此行 django 将抛出 DATABASE not found 错误

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': os.path.join(BASE_DIR, 'sqlite3'),
}
}

提前感谢您的解决方案

最佳答案

What's django-redis

django-redis is a BSD Licensed, full featured Redis cache/session backend for Django.

What's redis

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker

本质上,这意味着 django-redis 是一个 django 包,它允许您将默认的 memcache 替换为 django 的缓存后端,还允许您将 DB 替换为默认的 session 存储。然而,django-redis 没有实现将其用作 sqlite3 或任何其他数据库的替代品所需的功能。

关于python - 如何在Django-1.9中添加Redis数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41722513/

相关文章:

python - 如何在 Python 中按顺序打印为类创建的所有变量的列表?

python - 如何在 django 1.7.7 中使用 {{ request.path }}

Python从Java背景理解列表推导

python - 大 numpy 矩阵的 PIL 逊相关性

Django PostgreSQL JSONField db_index 错误

python - Apache 无法访问 Django 应用程序

arrays - 如何订阅 channel 数组Node + Redis

ruby-on-rails - 使用 Redis 的 Rails 片段缓存不会过期

node.js - socketio 与 redis 和 haproxy 的服务器间通信

python - 无法在 Ubuntu 的 Python 中导入 FANN