Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/encode/dashboard
An admin interface for ASGI Web frameworks.
https://github.com/encode/dashboard
asgi dashboard database orm
Last synced: 3 months ago
JSON representation
An admin interface for ASGI Web frameworks.
- Host: GitHub
- URL: https://github.com/encode/dashboard
- Owner: encode
- License: bsd-3-clause
- Archived: true
- Created: 2020-03-11T13:07:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-18T16:04:59.000Z (about 3 years ago)
- Last Synced: 2024-10-31T13:52:42.233Z (3 months ago)
- Topics: asgi, dashboard, database, orm
- Language: Python
- Homepage: https://www.encode.io/dashboard
- Size: 615 KB
- Stars: 135
- Watchers: 23
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
An admin dashboard for use with ASGI web frameworks.
**`dashboard` is still under development: We recommend pinning any dependencies with `dashboard~=0.1`**
**example.py**
```python
from starlette.applications import Starlette
from starlette.routing import Mount, Route
from starlette.responses import RedirectResponse
import databases
import dashboard
import orm
import datetimedatabase = databases.Database("sqlite:///test.db")
models = orm.ModelRegistry(database=database)class Notes(orm.Model):
registry = models
tablename = "notes"
fields = {
"id": orm.Integer(title="ID", primary_key=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"),
Route("/", endpoint=RedirectResponse(url="/admin")),
]app = Starlette(
debug=True,
routes=routes,
on_startup=[database.connect],
on_shutdown=[database.disconnect],
)
```Rough installation...
```shell
$ 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](https://twitter.com/cyberfart), [GitHub](https://github.com/eguven/)) for the `dashboard` PyPI package name.