Skip to main content

Stark Middlewares

Project description

stark_middlewares

Install package

pip install stark_middlewares

Usage

1. TrimMiddleware
  • Add the below lines in settings.
    MIDDLEWARE += [
      stark_middlewares.middlewares.TrimMiddleware
    ]
    
2. Maintenance Middleware
  • Add the below lines settings.

    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.

    iv. You can able to skip some endpoint as well SKIP_ENDPOINT=['login'] in settings.

3. Rolewise Permission
  • Add the below lines to add REST API Permission middleware

    MIDDLEWARE += [
      stark_middlewares.middlewares.UserRolePermission
    ]
    

    DEFAULT ALLOWED_METHOD_PERMISSIONS: ALLOWED_METHOD_PERMISSIONS = { "list": "view_", "retrieve": "view_", "create": "add_", "partial_update": "change_", "delete": "delete_", "change_status": "change_", "bulk_delete": "add_", }

    If you want to add more permission you can just add ALLOWED_METHOD_PERMISSIONS in settings. e.g. ALLOWED_METHOD_PERMISSIONS = { 'get_list': 'add_' }

    If you want to check the permission error then add SHOW_PERMISSION_ERROR=True in settings.

License

MIT

Stark Digital Media Services

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

stark-middlewares-0.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stark_middlewares-0.4-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file stark-middlewares-0.4.tar.gz.

File metadata

  • Download URL: stark-middlewares-0.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for stark-middlewares-0.4.tar.gz
Algorithm Hash digest
SHA256 0aa1d237c3c9fc8868d346cd87330e0501470d290da00acdf71daac8bef43317
MD5 e290eae80ea6a5ce8f09a8a54135ee37
BLAKE2b-256 42a1e9266089bda8984799ede1a086e29294a04f577c8bb4bdc095272392fc51

See more details on using hashes here.

File details

Details for the file stark_middlewares-0.4-py3-none-any.whl.

File metadata

  • Download URL: stark_middlewares-0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.9

File hashes

Hashes for stark_middlewares-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1d96bcc7fffc72956887e8ede6f5aaee71267ebfa06687fb4d8dd1b725b5d139
MD5 637c1459b6eb627c4c51dbb05c075822
BLAKE2b-256 e5d362004b7adda0cd45c0372dc823f4273fa0a4346980f012608e4bf73834d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page