https://github.com/getfleety/flask-coralillo
Flask integration for the Coralillo Redis ORM
https://github.com/getfleety/flask-coralillo
flask orm python redis
Last synced: 2 months ago
JSON representation
Flask integration for the Coralillo Redis ORM
- Host: GitHub
- URL: https://github.com/getfleety/flask-coralillo
- Owner: getfleety
- License: mit
- Created: 2017-08-21T16:24:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-06T22:34:19.000Z (about 8 years ago)
- Last Synced: 2025-02-17T13:04:18.366Z (over 1 year ago)
- Topics: flask, orm, python, redis
- Language: Python
- Homepage: https://getfleety.github.io/coralillo
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Flask Coralillo
===============
.. image:: https://travis-ci.org/getfleety/flask-coralillo.svg?branch=master
:target: https://travis-ci.org/getfleety/flask-coralillo
Integrates the Coralillo Redis ORM into flask
Usage
-----
This is an easy application that stores and retrieves cars from redis database.
.. code-block:: python
# app.py
from flask import Flask, request, redirect
from flask_coralillo import Coralillo
from coralillo import Model, fields
app = Flask(__name__)
engine = Coralillo(app)
class Car(Model):
name = fields.Text()
class Meta:
engine = engine
@app.route('/')
def list_cars():
res = '
Cars
- '
- {} '.format(car.name)
for car in Car.get_all():
res += '
res += '
Add car
' + \'' + \
'' + \
'' + \
''
return res
@app.route('/', methods=['POST'])
def add_car():
newcar = Car.validate(**request.form.to_dict()).save()
return redirect('/')
if __name__ == '__main__':
app.run()
Now if you run ``python app.py`` and you visit ``http://localhost:5000`` you will be able to intercact with your brand new Flask-Coralillo application.
For more information visit https://getfleety.github.io/coralillo/