在生产中使用 Django Flatpages:如何归档更改以进行恢复
我在生产站点中使用 Django Flatpages。我想找出最好的方法来确保如果管理员在编辑文件时出错,可以检索旧版本的页面。我们有备份等,但是恢复起来有点麻烦(即涉及系统管理员,而不是网站编辑器)。
首先,有没有一个包可以做到这一点?我不需要将所有数据库更改存档到文件系统或 MongelDB 的东西,但可能需要 Flatpages 附加组件。
如果没有,我想出了两种替代方案:
只需拥有一个临时服务器,所有实时更改都会在其中发生,然后加载到生产环境中
一些监视数据库的外部脚本,并在看到 Flatpages 内容的更改后,将最新内容的副本保存在其他表中,例如 FlatpagesHistory。然后网站编辑器可以使用管理服务从 FlatpagesHistory 检索页面的旧副本。有人做过吗?
感谢您的反馈。
谢谢。
I am using Django Flatpages in a production site. I'd like to figure out the best way to make sure if an admin makes a mistake editing a file, old version of the page can be retrieved. We have backups and such, but that's a bit more cumbersome to recover from (i.e. involves sysadmin, not website editor).
First, is there a package that does this? I don't need something that archives all db changes to the filesystem or MongelDB, but perhaps a Flatpages add-on.
If not, I came up with two alternatives:
Just have a staging server where all the live changes happen, then load on production
Some external script that monitors DB, and upon seeing changes to Flatpages contents, save a copy of the latest content in some other table, like FlatpagesHistory. Then website editor can just use Admin service to retrieve old copies of the pages from FlatpagesHistory. Has anyone done this?
I appreciate your feedback.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 django-reversion https://github.com/etianen/django-reversion
Try django-reversion https://github.com/etianen/django-reversion
没有得到回应,所以我正在挖掘一些。事实证明您可以非常轻松地实现这一点。
创建一个像这样的模型:
然后在 admin.py 文件中,像这样覆盖 Flatpage admin
你可以为你的 OldPage 有一个“只读”管理界面,就像这样
Didn't get a response, so I was digging a bit. Turns out you can just implement this very easily.
Create a model like this:
Then in a admin.py file, override flatpage admin like this
And you can have a "read-only" admin interface for your OldPage, like this