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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Built Distribution
Close
Hashes for sanic_base_extension-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d92ee5981f10b414522a42077d8f3ff4a6a72af5f01098efe49af87c5a75d1eb |
|
MD5 | acfd895e633cc4394111ccfe02753821 |
|
BLAKE2-256 | 3a92e31e6799c047634f63d206db0fb68c252658068ee04b1cbb38c9fab81adc |