An admin dashboard for use with ASGI web frameworks.
Work in progress.
example.py
from starlette.applications import Starlette
from starlette.routing import Mount, Route
from starlette.responses import RedirectResponse
from starlette.templating import Jinja2Templates
from starlette.staticfiles import StaticFiles
import databases
import dashboard
import orm
import datetime
database = databases.Database('sqlite:///test.db')
models = orm.ModelRegistry(database=database)
statics = StaticFiles(packages=['dashboard'])
class Notes(orm.Model):
registry = models
tablename = 'notes'
fields = {
'id': orm.Integer(title="ID", primary_key=True, read_only=True),
'created': orm.DateTime(title="Created", default=datetime.datetime.now, read_only=True),
'text': orm.String(title="Text", max_length=100),
'completed': orm.Boolean(title="Completed", default=False)
}
admin = dashboard.Dashboard(tables=[
dashboard.DashboardTable(ident="notes", title="Notes", datasource=Notes.objects.order_by('-id')),
])
routes = [
Mount("/admin", app=admin, name='dashboard'),
Mount("/statics", app=statics, name='static'),
Route("/", endpoint=RedirectResponse(url='/admin')),
]
app = Starlette(debug=True, routes=routes, on_startup=[database.connect], on_shutdown=[database.disconnect])
Rough installation...
$ virtualenv venv
$ venv/bin/pip install dashboard
$ venv/bin/python
>>> from example import models
>>> models.create_all()
$ venv/bin/uvicorn example:app
With many thanks to Eren Güven (Twitter, GitHub) for the dashboard PyPI package name.
Metadata
Release files for dashboard 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dashboard-0.0.6.tar.gz | 195.9 kB | Without provenance | Details for dashboard-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dashboard-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for dashboard-0.0.6-py3-none-any.whl |
Total release size: 397.0 kB
Release files / dashboard-0.0.6.tar.gz
| Download URL | dashboard-0.0.6.tar.gz |
|---|---|
| Size | 195.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38007d6d097704febfe1e983fbbae826b1b020f4314476b915576a4f236cdb67
|
|
BLAKE2b-256 checksum How to use checksums |
584a3dd2390c73d952d8edd27c42906924ffc339615a41ce226a1e62b78fdc5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Release files / dashboard-0.0.6-py3-none-any.whl
| Download URL | dashboard-0.0.6-py3-none-any.whl |
|---|---|
| Size | 201.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce8a1009059b45f7e80b3c033a634e1d53f29ee439dabff81ffe301a14b77962
|
|
BLAKE2b-256 checksum How to use checksums |
9150d38d44dae705d62b1ae3015b85d7a2eb5201a04d22ce676e2d8046d8a07e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
|
Security for dashboard 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.