Last active
August 29, 2015 14:20
-
-
Save NotTheEconomist/e001f7781e669b3da154 to your computer and use it in GitHub Desktop.
This file contains 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 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 |
This file contains 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 Blueprint | |
bp = Blueprint('posts', __name__) | |
@bp.record_once | |
def register(state): | |
from posts import views |
This file contains 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 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