├── README.md ├── app.py ├── static └── css │ └── main.css └── templates ├── base.html └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # FlaskIntroduction 2 | 3 | This is a repository to learn Flask. -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, url_for 2 | 3 | app = Flask(__name__) 4 | 5 | @app.route('/') 6 | def index(): 7 | return render_template('index.html') 8 | 9 | if __name__ == "__main__": 10 | app.run(debug=True) -------------------------------------------------------------------------------- /static/css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 100px; 3 | font-family: sans-serif; 4 | } 5 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {% block head %}{% endblock %} 8 | 9 | 10 | {% block body %}{% endblock %} 11 | 12 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block head %} 4 | 5 | {% endblock %} 6 | 7 | {% block body %} 8 |

Hello, world!

9 | {% endblock %} --------------------------------------------------------------------------------