Code Monkey home page Code Monkey logo

Comments (6)

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024 2

@stanim I have this feature in mind since long time, but actually I have not time to implement it, so I share with you my idea in case you want to send a PR:

MAINTENANCE_MODE_SCHEDULE={
    'mon': {
        'on': '03:00', 
        'off': '03:30',
    },
    'tue': {
        'on': '14:30', 
        'off': '14:45',
    },
    # for each day, or use * for all days
}

I would add support to a new setting like this one, what do you think about it?

from django-maintenance-mode.

stanim avatar stanim commented on May 27, 2024

The problem is that the business needs to be able to configure this from a webview. So Django settings are no solution, as settings are supposed to be immutable. Would it be possible to store the settings in the maintenance lock file?

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

I understand your needs, but it seems a specific case. The maintenance state file is not for this, you should write a custom state backend that return values based on the configuration done in the webview.
Check MAINTENANCE_MODE_STATE_BACKEND setting in the README.

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

@stanim check #66 if you are interested to implement a quick schedule system by @scwall using the backend/database, or check #48 if you need to control maintenance mode state using the admin.

from django-maintenance-mode.

miklevtsov avatar miklevtsov commented on May 27, 2024

I use https://django-constance.readthedocs.io/en/latest/ for configuring stuff like this. For example:

CONSTANCE_CONFIG = {
    "MAINTENANCE_ENABLED": (False, "Maintenance mode is enabled", bool),
    "MAINTENANCE_END": (datetime(2023, 11, 7, 11), "Maintenance mode end", datetime),
}

So you just need to implement MAINTENANCE_MODE_STATE_BACKEND as mentioned before to use this setting.

@fabiocaccamo Maybe you want to add this backend to your package, so people can choose the bundled backend if they use Constance?

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

@miklevtsov of which backend are you talking about?

I think that this should be managed at settings level as described here #66 (comment) and also that any backend implementation would be too specific.

from django-maintenance-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.