diff --git a/app/routes.py b/app/routes.py index 69701e3..d486cc3 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,7 +1,19 @@ +from flask import render_template from app import app @app.route('/') @app.route('/index') def index(): - return "Hello, World!" + user = {'username': 'Miguel'} + posts = [ + { + 'author': {'username': 'John'}, + 'body': 'Beautiful day in Portland!' + }, + { + 'author': {'username': 'Susan'}, + 'body': 'The Avengers movie was so cool!' + } + ] + return render_template('index.html', title='Home', user=user, posts=posts) diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000..56e87be --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,15 @@ + + + + {% if title %} + {{ title }} - Microblog + {% else %} + Welcome to Microblog + {% endif %} + + +
Microblog: Home
+
+ {% block content %}{% endblock %} + + diff --git a/app/templates/index.html b/app/templates/index.html new file mode 100644 index 0000000..b580e8c --- /dev/null +++ b/app/templates/index.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block content %} +

Hi, {{ user.username }}!

+ {% for post in posts %} +

{{ post.author.username }} says: {{ post.body }}

+ {% endfor %} +{% endblock %}