# 当 'discourse enable\_readonly' 启用时，站点自动退出只读模式。

**URL:** https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844
**Category:** Development
**Tags:** read-only
**Created:** [2024年二月27日 05:27 UTC](https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844 "2024-02-27T05:27:12Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2024年二月27日 18:39 UTC](https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844/4 "2024-02-27T18:39:36Z")

</div>

我也遇到了使用该功能的问题，包括启用和禁用只读模式。上次我最终在 rails 中运行了 `Discourse.enable_readonly_mode`。

每次发生这种情况都是紧急情况，我还没有调查过问题可能是什么。

供参考，在我自己的 Ansible 工具中，我不使用只读模式，但我使用了 [Introducing Post Deployment Migration](https://meta.discourse.org/t/introducing-post-deployment-migration/98974)

---

_[View the full topic](https://meta.discourse.org/t/site-automatically-exits-read-only-mode-when-enabled-by-discourse-enable-readonly/296844)._
