Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/relrin/sanic-base-extension
Flask-like extension support for Sanic framework
https://github.com/relrin/sanic-base-extension
extension python sanic
Last synced: 30 days ago
JSON representation
Flask-like extension support for Sanic framework
- Host: GitHub
- URL: https://github.com/relrin/sanic-base-extension
- Owner: Relrin
- License: bsd-3-clause
- Created: 2018-02-23T07:55:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T18:56:12.000Z (almost 2 years ago)
- Last Synced: 2024-10-08T11:09:10.987Z (about 1 month ago)
- Topics: extension, python, sanic
- Language: Python
- Size: 6.84 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
sanic-base-extension
####################
Flask-like extension support for Sanic frameworkFeatures
========
- Flask-like style initializing and using with Sanic applications
- Easy to write a new extension and use it laterInstallation
============
This package should be installed using pip: ::pip install sanic-base-extension
Example
=======
.. code-block:: pythonfrom sanic import Sanic
from sanic_base_ext import BaseExtensionclass CustomExtension(BaseExtension):
extension_name = app_attribute = 'custom'def hello(self, user):
print("Hello, {}!".format(user))app = Sanic(__name__)
CustomExtension(app) # available via `app.custom` or `app.extensions['custom']`
app.ctx.custom.hello('world') # Hello, world!License
=======
The sanic-base-extension is published under BSD license. For more details read LICENSE_ file... _links:
.. _LICENSE: https://github.com/Relrin/sanic-base-extension/blob/master/LICENSE