Skip to content

Instantly share code, notes, and snippets.

@sdiepend
Last active December 21, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdiepend/ef32e189863e7decaa2cb104e08c4c7e to your computer and use it in GitHub Desktop.
Save sdiepend/ef32e189863e7decaa2cb104e08c4c7e to your computer and use it in GitHub Desktop.
example init
from flask import Flask
from config import Config
from extensions import db
def create_app():
app = Flask(__name__)
app.config.from_object(Config)
db.init_app(app)
from views import author_bp
app.register_blueprint(author_bp)
from flask.ext.mongoalchemy import MongoAlchemy
db = MongoAlchemy()
from extensions import db
class Author(db.Document):
name = db.StringField()
class Book(db.Document):
title = db.StringField()
author = db.DocumentField(Author)
year = db.IntField();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment