Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
665 Widoki

Hello,

How can I put my website into maintenance mode to prevent visitors from seeing it? Only administrators should be able to log in.

Thank you

Awatar
Odrzuć
Najlepsza odpowiedź
Option 1: Use Odoo's Built-In Maintenance Mode (Enterprise Only)

If you're using Odoo.sh or Odoo Online (Enterprise) :


Steps:
  1. Go to : Settings > General Settings
  2. Scroll down to the “Maintenance Mode” section.
  3. Enable the maintenance mode toggle.
  4. Optionally, you can add allowed IPs so that your team can access the site during maintenance.

This automatically displays a maintenance message to public users.


Option 2: Manual Method (Works in All Editions – including Community)
Step-by-Step (Technical)
  1. Create a Custom Module or edit your current website module.
  2. Use a custom middleware or controller override to block public access.
Sample Code (Python Controller):
from odoo import http
from odoo.http import request

class WebsiteMaintenance(http.Controller):

    @http.route('/', auth='public', website=True)
    def homepage(self, **kw):
        if not request.session.uid: # If user is not logged in
            return request.render('your_module_name.maintenance_page')
        return request.redirect('/web') # Let admins access backend

    @http.route('/<path:path>', auth='public', website=True)
    def catch_all(self, path, **kwargs):
        if not request.session.uid:
            return request.render('your_module_name.maintenance_page')
        return request.redirect('/web')
  1. Create a template maintenance_page in your module's XML like this:
<template id="maintenance_page" name="Maintenance Page">
    <t t-call="website.layout">
        <div class="container">
            <h1>We'll be back soon!</h1>
            <p>The website is currently under maintenance. Please check back later.</p>
        </div>
    </t>
</template>
Option 3: Use Nginx/Apache for Maintenance (Server-Level)

If you're self-hosting, you can enable a maintenance.html page via your web server config (Nginx or Apache).


Thanks & Regards,

Email: contact@datainteger.com

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sie 24
1049
0
lut 24
1001
2
lut 25
1475
0
wrz 24
806
0
lut 24
991