----------------------------------index.html------------------------------ {% extends "bootstrap/base.html" %} {% block head %}iamhead{% endblock %} {% block styles %}iamstyles{% endblock %} {% block title %}iamtitle{% endblock %} {% block body %}iambody{% endblock %} {% block navbar %} <div class="navbar navbar-default" role="navigation"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="/">Flasky</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="/">Home</a></li> </ul> </div> </div> </div> {% endblock %} {% block content %} <div class="container"> <div class="page-header"> <h1>Hello, bootstrap3!</h1> </div> </div> {% endblock %} {% block scripts %} {{ super() }} <script type="text/javascript" src="my-script.js"></script> {% endblock %}
-----------------------------------flask.------------------ from flask import Flask from flask import render_template from flask_bootstrap3 import Bootstrap app = Flask(name) bootstrap = Bootstrap(app)
@app.route('/') def index(): return render_template('index.html') @app.route('/user/<name>') def user(name): mydict={'key':'key'} return render_template('user.html', name=name,mydict=mydict)
if name == 'main': app.run()