Skip to content

Instantly share code, notes, and snippets.

@NotTheEconomist
Last active August 29, 2015 14:20
Show Gist options
  • Save NotTheEconomist/e001f7781e669b3da154 to your computer and use it in GitHub Desktop.
Save NotTheEconomist/e001f7781e669b3da154 to your computer and use it in GitHub Desktop.
from flask import Flask
from sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def create_app(info=None):
app = Flask(__name__)
# config app commented out
db.init_app(app)
import posts
app.register_blueprint(posts.bp, url_prefix='/')
return app
from flask import Blueprint
bp = Blueprint('posts', __name__)
@bp.record_once
def register(state):
from posts import views
from flask import render_template
from posts import bp
@bp.route('/')
def show_posts():
return render_template('show_posts.html')
@bp.route('/add')
def add_posts():
return render_template('add_posts.html')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment