Django logs: any tutorial to log to a file

拥有回忆 提交于 2019-12-06 08:31:35

If you are talking about the Django admin log (the one that shows on the right side of the main page of the admin interface), you could just enable an admin model for the log itself.

Open the admin.py for one of your django apps and add this:

from django.contrib.admin.models import LogEntry

class LogEntryAdmin(admin.ModelAdmin):
    list_display = ('content_type', 'user', 'action_time')

admin.site.register(LogEntry, LogEntryAdmin)

It will give you a barebones interface for looking at the log.

Remember that log is only logging whatever happens through the admin interface itself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!