Skip to content

Instantly share code, notes, and snippets.

@toshimasa-nanaki
Created November 17, 2017 11:47
Show Gist options
  • Save toshimasa-nanaki/e2f47042fb547c01cd892b17a913150b to your computer and use it in GitHub Desktop.
Save toshimasa-nanaki/e2f47042fb547c01cd892b17a913150b to your computer and use it in GitHub Desktop.
Hello World API Python(render template)
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', title='test', userName='kentei')
@app.route('/hello')
def hello():
name = "Hello world!"
return name
if __name__ == "__main__":
app.run()
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<h1>ようこそ、{{userName}}</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment