Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): introduce a MaintenanceMiddleware #1395

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Conversation

b1rger
Copy link
Contributor

@b1rger b1rger commented Nov 15, 2024

Add a MaintenanceMiddleware that allows to set APIS in maintenance mode.
Maintenance mode allows superusers to access the site, but all other
requests get a simple maintenance page as a response.
This can be enabled by adding
apis_core.core.middleware.MaintenanceMiddleware to
settings.MIDDLEWARE. To active the maintenance mode simply create a
/tmp/apis_maintenance file. To deactivate maintenance mode, remove
that file.

Closes: #1296

@b1rger b1rger marked this pull request as ready for review November 15, 2024 08:59
@b1rger b1rger requested a review from sennierer November 15, 2024 08:59
Copy link
Collaborator

@sennierer sennierer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected. Please add a logging info that the site is running in maintenance mode and a comment in the docs that the path of the maintenance file can be changed.

apis_core/core/middleware.py Show resolved Hide resolved
apis_core/core/middleware.py Show resolved Hide resolved
docs/source/configuration.rst Outdated Show resolved Hide resolved
Add a MaintenanceMiddleware that allows to set APIS in maintenance mode.
Maintenance mode allows superusers to access the site, but all other
requests get a simple maintenance page as a response.
This can be enabled by adding
`apis_core.core.middleware.MaintenanceMiddleware` to
`settings.MIDDLEWARE`. To active the maintenance mode simply create a
`apis_maintenance` file. To deactivate maintenance mode, remove
that file.

Closes: #1296
@b1rger b1rger force-pushed the birger/1296-maintenance branch from c12dc88 to 7711519 Compare November 19, 2024 10:52
@b1rger
Copy link
Contributor Author

b1rger commented Nov 19, 2024

Implemented the suggestions and set the default of APIS_MAINTENANCE_FILE to apis_maintenance

@b1rger b1rger requested a review from sennierer November 19, 2024 10:53
Copy link
Collaborator

@sennierer sennierer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works in my installations. Thanks!

@b1rger b1rger merged commit 516b07c into main Dec 17, 2024
13 checks passed
@b1rger b1rger deleted the birger/1296-maintenance branch December 17, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add an easy possiblity to put sites in maintenance mode
2 participants