Last active
December 21, 2016 14:06
-
-
Save sdiepend/ef32e189863e7decaa2cb104e08c4c7e to your computer and use it in GitHub Desktop.
example init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask.ext.mongoalchemy import MongoAlchemy | |
db = MongoAlchemy() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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