Launchbox Helper for Django
A plugin for your Django app to assist in integrating with Launchbox.
Features
The plugin currently offers the following features:
- A helper class for easier configuration of settings for resources provided by Launchbox, like databases, caches, and storage buckets
- A class for querying an identity service provided by a Launchbox plugin
- An API for Launchbox to get information from your application so that it can display, or even change, that info within the Launchbox Management Dashboard
Planned features
- Integrations with other Launchbox plugin types – authentication and SSL certificate management
Installation
These steps assume that you have already added a launch.yaml file to your application.
For more information on that, visit the Launchbox docs.
- Add
django-launchboxto your project's requirements and install it. - Add
"launchbox"to yourINSTALLED_APPSsetting like this:INSTALLED_APPS = [ "launchbox", ... ]
- Update your Django settings to use the database provided by Launchbox:
from launchbox import LBResources DATABASES = { # "db" is the resource identifier specified in your launch.yaml file "default": LBResources().settings("db") }
- If you configured a cache or storage bucket in your
launch.yamlfile, update those settings, too:from launchbox import LBResources CACHES = { # "cache" is the resource identifier specified in your launch.yaml file "default": LBResources().settings("cache") } # AWS_STORAGE_BUCKET_NAME is a django-storages setting # "storage" is the resource identifier specified in your launch.yaml file AWS_STORAGE_BUCKET_NAME = LBResources().settings("storage")
- If you configured a cache or storage bucket in your
- If you want to manage users in the Launchbox dashboard,
add the
LB_USER_ATTRIBUTESsetting to specify which user model fields and properties you want to log and validate:LB_USER_ATTRIBUTES = [ "first_name", "last_name", "middle_initial", "display_name", "email", "admin_access", "is_active", "is_editor", "is_moderator", "is_owner", "is_superuser", ]
And then add the Launchbox bridge API URLs to theurlpatternsin your project'surls.py:# Launchbox Service Bridge API path("bridge/", include("launchbox.api.urls")),
Working with Launchbox plugins
Identity providers
Use the LBIdendity class to query an identity service provided by a Launchbox plugin.
For all examples given below, be sure you have imported the class with:
from launchbox import LBIdentity
You will need to know a plugin's plugin_id (an identifier internal to Launchbox) to work with it.
Get a specific user
To get a user's details when you know their exact user ID within the identity database, use the user.get() method:
user_details = LBIdentity("plugin_id").user.get("user_id")
Search for a user with partial matching
To search for a user when you aren't certain of their user ID, use the user.search() method:
user_details = LBIdentity("plugin_id").user.search("user_id")
Get the groups a user belongs to
For identity providers that can place users into groups,
you can get a list of a user's groups with the user.groups() method:
user_groups = LBIdentity("plugin_id").user.groups("user_id")
Get group details
To get the details of a group, use the group.get() method:
group_details = LBIdentity("plugin_id").group.get("group_id")
Metadata
Release files for django-launchbox 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-launchbox-1.0.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_launchbox-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / django-launchbox-1.0.tar.gz
| Download URL | django-launchbox-1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55afc073958075934f2cc2168e31ad34f729bb149d049b76158c8f7cb8e21132
|
|
BLAKE2b-256 checksum How to use checksums |
be28318eb29544bceba12592cc96d29268a92650979534044df6c49faef1fac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / django_launchbox-1.0-py3-none-any.whl
| Download URL | django_launchbox-1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec9e1ce3165aca1c3fdef07d1573bd1837e12ed9b4f5e08286bdac894bea829c
|
|
BLAKE2b-256 checksum How to use checksums |
1ecb252b032ddef803ab54f5c71f7ea3d32cecf9415a79e881503df4ae03eca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|