Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete Flask Demo #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flaskdemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def home():

@app.route('/about')
def about():
return "I am still working on this"
return render_template("about.html")


@app.route('/search', methods=['POST', 'GET'])
Expand Down
8 changes: 8 additions & 0 deletions templates/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "layout.html" %}
{% block title %}About{% endblock %}
{% block content %}
<h1>James is cool.</h1>
<h2> Practical 10</h2>
<p>This is the about page for practical 10</p>
<img width="800" height="800" src="https://media.tenor.com/x8v1oNUOmg4AAAAd/rickroll-roll.gif">
{% endblock %}
1 change: 1 addition & 0 deletions templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div id="nav">
<a href="{{ url_for('home') }}">Home</a> |
<a href="{{ url_for('search') }}">Search</a>
<a href="{{ url_for('about') }}">About</a>
</div>
<div id="content">
{% block content %}{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{% block title %}Wikipedia Results{% endblock %}
{% block content %}
{% if page %}
{# TODO: add page title and more... #}

<h1>Results</h1>
<h2>Summary </h2>
<p>{{ page.summary }}</p>
<p><a href="{{ page.url }}"> {{ page.title }}</a> </p>
Expand Down