Stark Middlewares
Project description
stark_middlewares
Install
pip install stark_middlewares
Usage
- Add the below lines to trim request body middleware
MIDDLEWARE += [
stark_middlewares.middlewares.TrimMiddleware
]
- Add the below lines to add MAINTENANCE MODE middleware
MIDDLEWARE += [
stark_middlewares.middlewares.MaintenanceModeMiddleware
]
i. If you want to add the site under maintenance mode set IS_MAINTENANCE_MODE=True in settings
ii. You can whitelist the IP using MAINTENANCE_IPS=[] in settings
iii. You can able to check the invalid IP using SHOW_MAINTANCE_INVALID_IP=True in settings.
- Add the below lines to add REST API Permission middleware
MIDDLEWARE += [
stark_middlewares.middlewares.UserRolePermission
]
i. DEFAULT ALLOWED_METHOD_PERMISSIONS:
ALLOWED_METHOD_PERMISSIONS = {
"list": "view_",
"retrieve": "view_",
"create": "add_",
"partial_update": "change_",
"delete": "delete_",
"change_status": "change_",
"bulk_delete": "add_",
}
ii. If you want to add more permission you can just add ALLOWED_METHOD_PERMISSIONS in settings.
e.g. ALLOWED_METHOD_PERMISSIONS = {
'get_list': 'add_'
}
iii. If you want to check the permission error then add SHOW_PERMISSION_ERROR=True in settings.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for stark_middlewares-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecf5d795e77940056388c4de5e5cffd4ce82878fca614ed2f8d429f91a1b355c |
|
MD5 | 70d0951af299876eb2baaaeefdf48022 |
|
BLAKE2b-256 | 7f06fa72e449b4e248c94a7bd7a392788e5bf619012c776ed9835435d1013d19 |