sqlalchemy flask mongo code example
Example 1: mongoalchemy flask
from flask import Flask
from flask.ext.mongoalchemy import MongoAlchemy
app = Flask(__name__)
app.config['MONGOALCHEMY_DATABASE'] = 'library'
db = MongoAlchemy(app)
class Author(db.Document):
name = db.StringField()
class Book(db.Document):
title = db.StringField()
author = db.DocumentField(Author)
year = db.IntField()
Example 2: mongoalchemy flask
$ [sudo] pip install Flask-MongoAlchemy