46 lines
1.2 KiB
Markdown
46 lines
1.2 KiB
Markdown
# flask-calibrestekje {#header}
|
|
|
|
[![Repository license](https://img.shields.io/badge/license-GPL-brightgreen.svg)](LICENSE)
|
|
[![PyPI package](https://badge.fury.io/py/flask-calibrestekje.svg)](https://badge.fury.io/py/flask-calibrestekje)
|
|
[![Travis CI result](https://travis-ci.com/decentral1se/flask-calibrestekje.svg?branch=master)](https://travis-ci.com/decentral1se/flask-calibrestekje)
|
|
[![Documentation status](https://readthedocs.org/projects/calibrestekje/badge/?version=latest)](https://calibrestekje.readthedocs.io/en/latest/)
|
|
[![Support badge](http://img.shields.io/liberapay/patrons/decentral1se.svg?logo=liberapay)](https://liberapay.com/decentral1se)
|
|
|
|
## Library prototyping based on Calibre with Flask
|
|
|
|
### Example
|
|
|
|
#### app.cfg
|
|
|
|
``` cfg
|
|
CALIBRESTEKJE_SQLITE_URL = "sqlite:///mymetadata.db"
|
|
```
|
|
|
|
#### app.py
|
|
|
|
``` python
|
|
from calibrestekje import Book
|
|
from flask import Flask, jsonify
|
|
|
|
from flask_calibrestekje import CalibreStekje
|
|
|
|
app = Flask(__name__)
|
|
app.config.from_pyfile("app.cfg")
|
|
db = CalibreStekje(app)
|
|
|
|
@app.route("/")
|
|
def home():
|
|
return jsonify({"book-count": db.session.query(Book).count()})
|
|
```
|
|
|
|
#### command-line
|
|
|
|
``` bash
|
|
$ export FLASK_APP=app.py
|
|
$ flask run
|
|
```
|
|
|
|
### Documentation
|
|
|
|
- <https://calibrestekje.readthedocs.io/>
|