forked from miguelgrinberg/microblog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23b3fc8
commit 5d45592
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
{% if title %} | ||
<title>{{ title }} - Microblog</title> | ||
{% else %} | ||
<title>Welcome to Microblog</title> | ||
{% endif %} | ||
</head> | ||
<body> | ||
<div>Microblog: <a href="/index">Home</a></div> | ||
<hr> | ||
{% block content %}{% endblock %} | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Hi, {{ user.username }}!</h1> | ||
{% for post in posts %} | ||
<div><p>{{ post.author.username }} says: <b>{{ post.body }}</b></p></div> | ||
{% endfor %} | ||
{% endblock %} |