Created
November 17, 2017 11:47
-
-
Save toshimasa-nanaki/e2f47042fb547c01cd892b17a913150b to your computer and use it in GitHub Desktop.
Hello World API Python(render template)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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