Flask-like extension support for Sanic framework
Project description
Forked from and based on https://github.com/Relrin/sanic-base-extension (sanic-base-extension) Extensions were forked and modified to keep the code updated with the latest version of dependecnies and to add additional functionality
sanic-ext-base
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-ext-base
Example
from sanic import Sanic
from sanic_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-ext-base 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.
Source Distribution
sanic-ext-base-0.1.0.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for sanic_ext_base-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed4d3a21b8d2eb58409eeac54101b71cb4bad1c991e43f6ebffd812571253c09 |
|
MD5 | dd4096fda283ffca4c61f5efb39b45ab |
|
BLAKE2b-256 | bf1094191ec152592013f512a55ea9bc7d6bb3ac3de4dd780d25d226137d6554 |