1$ export FLASK_APP=hello.py
2$ python -m flask run
3 * Running on http://127.0.0.1:5000/
4
1from flask import Flask
2app = Flask(__name__)
3
4@app.route('/')
5def hello_world():
6 return 'Hello, World!'
7
1# coding: utf-8
2from flask import Flask, render_template
3from flask.ext.gist import Gist
4
5app = Flask(__name__, template_folder='.')
6Gist(app)
7
8
9@app.route('/')
10def index():
11 return render_template('example.html')
12
13
14if __name__ == "__main__":
15 app.run(host='0.0.0.0', debug=True)
1# -*- coding: utf-8 -*-
2# Librarys
3from flask import Flask, render_template
4from flask_sqlalchemy import SQLAlchemy
5
6# Variables
7app = Flask(__name__)
8
9# Settings
10app.config['DEBUG'] = True
11app.config['SECRET_KEY'] = 'secret'
12
13
14
15app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.sqlite'
16app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
17db = SQLAlchemy()
18db.init_app(app)
19
20
21
22# Views
23@app.route('/', methods=('GET', 'POST'))
24def index():
25 return render_template('name.html')
26
27
28# Run
29if __name__ == '__main__':
30 app.run()
31