Skip to main content

Flask-like extension support for Sanic framework

Project description

Flask-like extension support for Sanic framework

Features

  • Flask-like style initializing and using with Sanic applications

  • Easy to write a new extension and use it later

Installation

This package should be installed using pip:

pip install sanic-base-extension

Example

from sanic import Sanic
from sanic_base_ext import BaseExtension


class CustomExtension(BaseExtension):
    extension_name = app_attribute = 'custom'

    def hello(self, user):
        print("Hello, {}!".format(user))


app = Sanic(__name__)
CustomExtension()  # available via `app.custom` or `app.extensions['custom']`
app.custom.hello('world')  # Hello, world!

License

The sanic-base-extension is published under BSD license. For more details read LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file sanic_base_extension-0.1.0-py3-any.whl.

File metadata

File hashes

Hashes for sanic_base_extension-0.1.0-py3-any.whl
Algorithm Hash digest
SHA256 a39b12595f0dc951a18e1f769ad32a7edbf04e9ede41aa820e6b128074836669
MD5 8a5128ef4b17a67f145cccb343f6eecb
BLAKE2b-256 93aca14f11ffa9645f16122805749342bbf5cd68214fd8bb667ee0f621c49c60

See more details on using hashes here.

Supported by

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