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.

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.1.tar.gz (3.5 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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stark-middlewares-0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.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.1.tar.gz
Algorithm Hash digest
SHA256 ffed7d7ebb71bcd296b2e61baefcd204d66ef0f0c66ce6a19303d71c5f327a71
MD5 7ff1fe59ae84c9ebec695c4248098250
BLAKE2b-256 81401b259b90ef15f00a1fb860b16cde49f24a494b42957cf40d7186cd7f2202

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stark_middlewares-0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79320fd85037fdb5b1111e2f62c490aa292e559aeb879227bda5fbed25d1f0e4
MD5 5419cd89903729b48a028ef850924fe2
BLAKE2b-256 47e7559deab825e652c289e6a5704a3d49128233851442311d127d1ee7343efb

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