python - 数据库错误: no such table: django_template

标签 python django django-models django-admin django-flatpages

当我尝试在管理员中访问自定义版本的平面页面时,出现此错误:

数据库错误:没有这样的表:django_template

在设置中,我安装了平面页面、中间件,当然还有我的自定义平面页面...可能是什么问题?

这是我的自定义平面模型和管理员,我正在尝试让平面页面进行翻译。

我猜我必须更改平面上的模板标签才能使用我的自定义模型...

我的平面页面模型 -> https://gist.github.com/2052903

我的平面页面管理 -> https://gist.github.com/2052907

和查找翻译实用程序 -> https://gist.github.com/2052919

欢迎所有更改代码或任何内容的建议...

===编辑===

这是我的设置文件 -> https://gist.github.com/2054598

这是完整的错误回溯 -> http://dpaste.com/717679/

当我尝试访问平面管理页面时发生此错误

谢谢大家!

最佳答案

这是因为 TEMPLATE_LOADERS 中有“dbtemplates.loader.Loader”,但 INSTALLED_APPS 中没有“dbtemplates”。

因此,要么将“dbtemplates”添加到 INSTALLED_APPS 和syncdb,要么从 TEMPLATE_LOADERS 中删除“dbtemplates.loader.Loader”。

注意:如果您打算使用 dbtemplates,那么您应该真正使用 JohnnyCache(如果您不希望在每次模板加载时都进行数据库查询)。

关于python - 数据库错误: no such table: django_template,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9744898/

相关文章:

django - 如何从嵌套在字典中的 Django 模型获取格式良好的 json 转储?

django - 通过django中的字段查询中间

python - 在 csv python 中排序、分组和计算平均值

python - 如何在测试时将 Django/DRF 中的日期时间转换为字符串

django - Django 和 Celery 的解耦和 Docker 化

django - 如何在 django 中更新 request.user ?

python - 查询数据库而不需要任何迁移 Django

django - 如何使用 django 表单集创建带有问题和答案的调查应用程序?

python - 通过 Telethon 报告垃圾邮件或滥用行为

python - 缩放数据时,为什么训练数据集使用 'fit' 和 'transform' ,而测试数据集只使用 'transform' ?