price_flask.py #2
from flask import Flask, render_template, request import sqlite3 as sql import math app = Flask(__name__) @app.route('/') def home(): return render_template('home.html') @app.route('/price') def list(): # 処理 if __name__ == '__main__': app.run(debug = True)
①Flaskを使って@app.route('/price')
の部分がURLになる。
設定した場合はいかにアクセスると見れる。
http://localhost:5000/price
②return render_template('home.html') この部分はtemplateディレクトリにある指定のファイルを返す。