from flask import Flask, render_template import pymysql app = Flask(__name__) def getConnection(): return pymysql.connect( host="localhost", db="hoge", user="fuga", password="hou", charset="utf8", cursorclass=pymysql.cursors.DictCursor ) @app.route("/") def index(): connection = getConnection() sql = "SELECT * FROM avalanche where id = 1" cursor = connection.cursor() cursor.execute(sql) results = cursor.fetchall() cursor.close() connection.close() return render_template('index.html', results=results) if __name__ == "__main__": app.run(debug=True, host='0.0.0.0', port=5000)
なるほど
これをdockerでやりたい