Created
November 2, 2012 17:22
-
-
Save madzak/4002904 to your computer and use it in GitHub Desktop.
Blueprint with DB
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
#!/usr/bin/env python | |
# coding=utf8 | |
from flask import Blueprint, current_app | |
from flask.ext.sqlalchemy import SQLAlchemy | |
app = current_app | |
db = SQLAlchemy(app) | |
class Block(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String(80), unique=True) | |
type = db.Column(db.String(120), unique=True) | |
def __init__(self, username, email): | |
self.username = username | |
self.email = email | |
def __repr__(self): | |
return '<Block %r>' % self.name | |
class ContentBlocks(object): | |
def __init__(self, app=None): | |
self.app = None | |
if app is not None: | |
self.app = app | |
self.init_app(self.app) | |
def init_app(self, app): | |
#app.config.setdefault('S3_BUCKET_DOMAIN', 's3.amazonaws.com') | |
blueprint = Blueprint( | |
'ContentBlocks', | |
__name__) | |
app.register_blueprint(blueprint) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment