如何将 django-db-log 模型添加到管理面板?
刚刚安装了 django-db-log 模块并尝试使其正常工作。 “python manage.pysyncdb”命令创建了数据库,日志记录似乎有效,但管理面板中没有任何内容。正如我在文档中发现的那样,它应该将自身添加到管理面板中,而无需任何其他配置,但后来我在 MIDDLEWARE_CLASSES 中添加了“djangodblog.middleware.DBLogMiddleware”,在 INSTALLED_APPS 中添加了“djangodblog”,看起来什么也没有发生。我做错了什么?
Just installed django-db-log module and trying to make it work properly. 'python manage.py syncdb' command created databases, it seems like logging works, but there is nothing about it in admin panel. As I found in documentation, it should add itself in admin panel without any additional configuration, but then I added 'djangodblog.middleware.DBLogMiddleware' in MIDDLEWARE_CLASSES and 'djangodblog' in INSTALLED_APPS it looks like nothing happens. What I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
感谢您的解决方法,我遇到了同样的问题,我的管理界面没有显示 djangodblog 表。
虽然我已经安装了最新的 django_db_log-1.5.0-py2.6.egg 和 Django 1.1.1 版本。
我将创建的 djangodblog 目录移动到我的 Django 项目目录中,然后我的管理界面显示 djangodblog 表。
谢谢您并致以最诚挚的问候。
thank your for your workaround, I had the same problem that my admin interface didn't show djangodblog tables.
Although I have installed the recent django_db_log-1.5.0-py2.6.egg with Django 1.1.1 version.
I moved the created djangodblog directory into my Django project dir, then my admin interface shows the djangodblog tables.
Thank you and best regards.
是的,它应该将自己添加到管理部分。它是为我添加的。
所以如果你没有明白,我唯一想到的是,你正在使用旧版本的 django。
Yes it should add itself to admin section. And its added for me.
So if you are not getting it, only thing that comes to my mind is, you are using older version of django.
它在我的机器上也不起作用(Mac OS X 10.6)。它将错误记录到数据库,但没有出现在管理中。
我通过以下方式修复了它:
从 Python 的站点包中删除 django_db_log...egg 文件(以卸载它),将 Egg 文件解压缩到临时目录,并将创建的 djangodblog 目录移动到我的 Django 项目目录中。
这确实成功了,但是这样你就失去了 easy_install 功能(当然)。
It didn't work on my machine either (Mac OS X 10.6). It logged errors to the DB, but did not appear in admin.
I fixed it the following way:
Removed the django_db_log...egg file from Python's site-packages (to uninstall it), unzipped the egg file to a temp directory and moved the created djangodblog directory into my Django project dir.
This did the trick, but you lose the easy_install features this way (of course).
有点解决办法,但将以下内容添加到 admin.py 文件之一对我有用。
bit of a work around but adding the following to one of an admin.py file works for me.