pip install flask
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'Hello' if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0', port=80) #127.0.0.1:80 #localhost:80
htmlファイル: templatesディレクトリに配置 CSS,JavaScriptファイル: staticディレクトリに配置
from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0', port=88)
head> link rel="stylesheet" href="{{url_for('static', filename='index.css')}}"> script src="{{url_for('static', filename='index.js')}}">/script> /head>