Skip to content
Neuron Teckid edited this page May 3, 2016 · 1 revision

Customize Your App

Since v0.9. A knowledge of Python and Flask is required.

The keypoints of customization are to override the Flask application class of RedisCtl, and to specify your implementation for instantiation. To write your own subclass, inherit app.RedisCtl. To specify your own class, you could either set the env-var APP_CLASS to a string is acceptable by werkzeug.utils.import_string, or modify config.py change the last line to

import your_package
App = your_package.YourApp

General Overridable Member Functions in RedisApp

# the constructor; inheritance ought to call the constructor upon instantiation
#   - config: the global configuration; generally, just use "import config; RedisApp.__init__(self, config)"
__init__(self, config)

# produce a MySQL URI for SQLAlchemy from the config. override it when you are using other databases
db_uri(self, config)

# for extra Flask Blueprints; by default it return an empty list
# you may override it to offer more Blueprints to the app, for example, an auth module
# each element in the returned value should be a Blueprint object
ext_blueprints(self)

Override Other Modules

Some of the above depends on the config so you may modify it as well.

Clone this wiki locally