This exercise uses your programming environment to enhance theWeb site you created last week with additional functionality toinclude images, tables and a Form using Python flask. Specifically,you will add two (2) additional routes allowing a user to registerand login to a web site. Additional security considerations includeother routes (beyond the register route) will not be accessibleuntil a successful login has occurred.
In addition to the requirements list above the followingfunctionality should be found within your web siteon one or more web pages.
Add at least 4 different images. The images should be local inyour environment. For example, they should be saved in yourenvironment and referenced similar to this syntax: <imgsrc="image.gif">
A Table with at least 4 rows and 3 columns.
A user registration form
A user login form
A password complexity should be enforced to include at least12 characters in length, and include at least 1 uppercasecharacter, 1 lowercase character, 1 number and 1 specialcharacter.
The content and topic of the new images, and tables are up toyou. How much is required for the user registration is up to you aswell. However, the registration and associated login should containat least a login name and password.
Last code is below
app.py
from datetime import date
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index.html')
def home():
return render_template('index.html', date = date.today() )
@app.route('/page2.html')
def page2():
return render_template('page2.html', date = date.today() )
@app.route('/page3.html')
def page3():
return render_template('page3.html', date = date.today() )
if __name__ == '__main__':
app.run(debug = True)
index.html
<html>
<head>
<title>Index Page</title>
<link rel= "stylesheet" type= "text/css" href= "{{url_for('static',filename='styles/style.css') }}">
</head>
<body>
<h1>Page 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<div class="separate">
<ol>
<li>One</li>
<li>Two</li>
</ol>
</div>
<div class="separate">
<ul>
<li>One</li>
<li>Two</li>
</ul>
</div>
<!--Display the date passed from python-->
<p>Today is {{date}}</p>
<br>
<a href="https://www.google.com">Visit Site1</a>
<a href="https://www.google.com">Visit Site2</a>
<a href="https://www.google.com">Visit Site3</a>
<br>
<a href="/page2.html">Page 2</a>
<a href="/page3.html">Page 3</a>
</body>
</html>
page2.html
<html>
<head>
<title>Page 2</title>
<link rel= "stylesheet" type= "text/css" href= "{{url_for('static',filename='styles/style.css') }}">
</head>
<body>
<h1>Page 2</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<div class="separate">
<ol>
<li>One</li>
<li>Two</li>
</ol>
</div>
<div class="separate">
<ul>
<li>One</li>
<li>Two</li>
</ul>
</div>
<!--Display the date passed from python-->
<p>Today is {{date}}</p>
<br>
<a href="https://www.google.com">Visit Site1</a>
<a href="https://www.google.com">Visit Site2</a>
<a href="https://www.google.com">Visit Site3</a>
<br>
<a href="/index.html">Home Page</a>
<a href="/page3.html">Page 3</a>
</body>
</html>
page3.html
<html>
<head>
<title>Page 3</title>
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='styles/style.css') }}">
</head>
<body>
<h1>Page 3</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<div class="separate">
<ol>
<li>One</li>
<li>Two</li>
</ol>
</div>
<div class="separate">
<ul>
<li>One</li>
<li>Two</li>
</ul>
</div>
<!--Display the date passed from python-->
<p>Today is {{date}}</p>
<br>
<a href="https://www.google.com">Visit Site1</a>
<a href="https://www.google.com">Visit Site2</a>
<a href="https://www.google.com">Visit Site3</a>
<br>
<a href="/index.html">Home Page</a>
<a href="/page2.html">Page 3</a>
</body>
</html>
style.css
.separate{
margin-top: 10px;
}
This exercise uses your programming environment to enhance the Web site you created last week with additional functional
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am