コード例 #1
0
ファイル: webapp.py プロジェクト: TheWaWaR/blog
def create_app():

    tApp = Flask(__name__)
    tApp.config.from_pyfile('settings.py')

    blueprints = [bp_blog]
    for bp in blueprints:
        tApp.register_blueprint(bp)

    init_pages_posts(tApp.root_path)
    ############################################################
    # Request management
    @tApp.before_request
    def before_request():
        pass

    # Error Handler
    @tApp.errorhandler(404)
    def error_404(e):
        return 'Not Found! There is nothing here......', 404

    return tApp
コード例 #2
0
ファイル: views.py プロジェクト: TheWaWaR/blog
def rebuild():
    PAGES.clear()
    POSTS.clear()
    CATEGORIES.clear()
    init_pages_posts(current_app.root_path)
    return '<pre>{}</pre> <hr/> <a href="/">Home</a>'.format('<br />'.join(POSTS.keys()))