from app import app
from flask import make_response

@app.route('/')
@app.route('/index')
def index():
    return make_response(open(app.root_path + '/templates/index.html').read())
from flask import render_template
from app import app

@app.route('/')
@app.route('/index')
def index():
    user = { 'nickname': 'Marvolo' } # fake user
    posts = [ # fake array of posts
        {
            'author': { 'nickname': 'John' },
            'body': 'Beautiful day in Portland!'
        },
        {
            'author': { 'nickname': 'Susan' },
            'body': 'The Avengers movie was so cool!'
        }
    ]
    return render_template("index.html",
        title = 'Home',
        user = user,
        posts = posts)
Set up mock data for index
Set up mock data for index

+ from flask import render_template
  from app import app
- from flask import make_response
  
  @app.route('/')
  @app.route('/index')
  def index():
-     return make_response(open(app.root_path + '/templates/index.html').read())
+     user = { 'nickname': 'Marvolo' } # fake user
+     posts = [ # fake array of posts
+         {
+             'author': { 'nickname': 'John' },
+             'body': 'Beautiful day in Portland!'
+         },
+         {
+             'author': { 'nickname': 'Susan' },
+             'body': 'The Avengers movie was so cool!'
+         }
+     ]
+     return render_template("index.html",
+         title = 'Home',
+         user = user,
+         posts = posts)
Set up mock data for index
## Code Before:
from app import app
from flask import make_response

@app.route('/')
@app.route('/index')
def index():
    return make_response(open(app.root_path + '/templates/index.html').read())
## Instruction:
Set up mock data for index
## Code After:
from flask import render_template
from app import app

@app.route('/')
@app.route('/index')
def index():
    user = { 'nickname': 'Marvolo' } # fake user
    posts = [ # fake array of posts
        {
            'author': { 'nickname': 'John' },
            'body': 'Beautiful day in Portland!'
        },
        {
            'author': { 'nickname': 'Susan' },
            'body': 'The Avengers movie was so cool!'
        }
    ]
    return render_template("index.html",
        title = 'Home',
        user = user,
        posts = posts)