Skip to main content

DStore Web API and JS Client using FLask

Project description

https://img.shields.io/coveralls/MarkLark/flask-dstore.svg https://img.shields.io/travis/MarkLark/flask-dstore/master.svg https://img.shields.io/pypi/v/flask-dstore.svg https://img.shields.io/pypi/pyversions/flask-dstore.svg

Flask-DStore is a Web API and Javascript Client. The API routes, logic and client code is automatically generated for you.

Installing

PyMan is available from the PyPi repository.

This means that all you have to do to install PyMan is run the following in a console:

$ pip install dstore-flask

Minimal Example

from flask import Flask
from dstore import MemoryStore, Model, var, mod
from flask_dstore import API

class Car( Model ):
    _namespace = "cars.make"
    _vars = [
        var.RowID,
        var.String( "manufacturer", 32, mods = [ mod.NotNull() ] ),
        var.String( "make", 32, mods = [ mod.NotNull() ] ),
        var.Number( "year", mods = [ mod.NotNull(), mod.Min( 1950 ), mod.Max( 2017 ) ] ),
    ]

# Create the app instances
app = Flask( __name__ )
store = MemoryStore( [ Car ] )
api = API( store, app )

# While inside the Flask app context, create all storage and add a car
with app.app_context():
    store.create_all()
    Car( manufacturer = "Holden", make = "Commodore", year = 2005 ).add()

# Run the Flask dev. server
app.run()

# Now destroy all data
with app.app_context():
    store.destroy_all()

store.destroy_app()

Documentation: ReadTheDocs

Source Code: GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-DStore-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

Flask_DStore-0.1.2-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Flask-DStore-0.1.2.tar.gz.

File metadata

File hashes

Hashes for Flask-DStore-0.1.2.tar.gz
Algorithm Hash digest
SHA256 52dcc34b578f68f426a190d1439687a26423336f7c92e43d7fe94ceb459bff47
MD5 c0ac8f4bed680e5c25a027e6452ea597
BLAKE2b-256 2ced59af668e7266c7c611eabd37201dfa3b2ea71a79acb480f43c97642b6af7

See more details on using hashes here.

File details

Details for the file Flask_DStore-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_DStore-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dd948571bd2ad923886dec0a9ef9128d838bdf7e898ffb20e96f6a50103b4981
MD5 5deba581a919ead9ce4f617375e1028e
BLAKE2b-256 932b0ebb364a99384614ab901650ff12e92fd2b462961f52677e4a73534ec2f8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page