Django:内存数据库django.db.backends.sqlite3 + SessionMiddleware?

Django: In memory database django.db.backends.sqlite3 + SessionMiddleware?

我正在使用带有 py34 的 django 1.10.5。

我想配置数据库,以便一切都发生在内存中:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': ':memory:',
}

我还想覆盖用户身份验证,解释为 here 因为登录名和密码必须从我自己的 conf.ini 文件中加载。

修改后报错:

OperationalError at /
no such table: django_session 
During handling of the above exception ('SessionStore' object has no attribute '_session_cache'), another exception occurred: 

是否无法将中间件 django.contrib.sessions.middleware.SessionMiddleware 与内存数据库一起使用?

内存数据库在创建它的进程退出后立即被销毁。您可以通过连续执行 ./manage.py migrate./manage.py showmigrations 轻松检查:没有记录迁移。

简而言之:这行不通。