← flask-blog

added templates

f6377d8b74ad10d481c30deaa361db365447ed1d · ovidiucs · May 12, 2015 19:22

+27 −3 · 3 files changed

  • flask-blog.py +7 −3
  • templates/index.html +10 −0
  • templates/user.html +10 −0
diff --git a/flask-blog.py b/flask-blog.py
index 4b059ec..87ae9d2 100644
--- a/flask-blog.py
+++ b/flask-blog.py
@@ -1,12 +1,16 @@
-from flask import Flask
+from flask import Flask, render_template
 
 app = Flask(__name__)
 
 
 @app.route('/')
 def hello_world():
-    return 'Hello World!'
+    return render_template('index.html')
+
+@app.route('/user/<name>')
+def user(name):
+    return render_template('user.html',name=name)
 
 
 if __name__ == '__main__':
-    app.run()
+    app.run(debug=True)
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..f7c941e
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title></title>
+</head>
+<body>
+    <h1>Hello World</h1>
+</body>
+</html>
\ No newline at end of file
diff --git a/templates/user.html b/templates/user.html
new file mode 100644
index 0000000..e71891b
--- /dev/null
+++ b/templates/user.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title></title>
+</head>
+<body>
+    <h1>Hello, {{ name }}</h1>
+</body>
+</html>
\ No newline at end of file