Metadata-Version: 2.1
Name: piccolo-admin
Version: 0.1.2
Summary: A simple and powerful admin for Piccolo models, using ASGI.
Home-page: https://github.com/piccolo-orm/piccolo_admin
Author: Daniel Townsend
Author-email: dan@dantownsend.co.uk
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
Requires-Dist: starlette (>=0.12.2)
Requires-Dist: piccolo (>=0.3.6)
Requires-Dist: piccolo-api (>=0.1.1)
Requires-Dist: uvicorn (>=0.8.3)
Requires-Dist: aiofiles (==0.4.0)

# Piccolo Admin

piccolo_admin provides a simple admin interface on top of Piccolo models.

![Screenshot](https://raw.githubusercontent.com/piccolo-orm/piccolo_admin/master/docs/images/screenshot.png "Screenshot")

## Demo

To run a demo, using Python 3.7 or above:

```bash
pip install piccolo_admin
admin_demo
```

And then just launch `localhost:8000` in your browser.

To see what happens behind the scenes, see `piccolo_admin/example.py`.

In a few lines of code we are able to:

 * Define our models
 * Setup a database
 * Create a REST API
 * Setup a web server and admin interface

## ASGI

Since the admin is an ASGI app, you can either run it standalone like in the demo, or integrate it with a larger ASGI app.

For example, using Starlette routes:

```python
from piccolo_admin.endpoints import AdminRouter
from starlette.routing import Router, Route
import uvicorn

from my_project.tables import Movie, User
from my_project.endpoints import Hello


admin = AdminRouter(Movie, auth_table=User)


router = Router([
    Route(path="/", endpoint=Hello),
    Mount(path="/admin/", app=admin),
])


if __name__ == '__main__':
    uvicorn.run(router)

```

## Contributing

The backend is just vanilla Python.

The front end is built using Vue.js. To make modifications, clone the repo, and cd into the `admin_ui` directory.

Install the npm dependencies:

```bash
npm install
```

And then you can launch the admin as follows:

```bash
npm run serve
```

It will auto refresh the UI as you make changes to the source files.

The UI needs an API to interact with - the easiest way to do this is to use the demo app.

```bash
admin_demo
```


