Question

In: Computer Science

Generate a modest Web page via Python flask. It should include basic components of HTML. The...

Generate a modest Web page via Python flask. It should include basic components of HTML. The Web page should have at least three Headings(<h1>), a paragraph (<p>), comments (<!-- -->), ordered list, unordered list, three links to website, and should display time & date.

Solutions

Expert Solution

Hi,

The following is the python code and HTML page for this assignment.  

Please ensure the following

1. Install Flask module with the command - "pip install flask"
2. Copy the server.py file
3. Create a sub folder in the current location with name "templates"
4. Copy the index.html to the "templates" folder
5. Please ensure the server.py is correctly indented (refer to screenshot)

If you have any issues or questions, please leave me a comment. I shall help you in resolving them.

If this solution helps with your assignment, please do upvote.

Thank you.

#server.py

from flask import Flask
from flask import render_template
import datetime

#Initialize the Flask app
app = Flask(__name__)

#Handle the default route
@app.route("/")
def home_page():

#Get the current date/time and format it
now = datetime.datetime.now()
current_date_time = now.strftime("%Y-%m-%d %H:%M:%S")

#Display the HTML page in templates folder and pass the datevar
#to the template
return render_template("index.html", datevar=current_date_time)

if __name__ == "__main__":
app.run()

### index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Python Flask Example</title>
</head>
<body>
<h1>This is a Heading #1</h1>
<h1>This is a Heading #2</h1>
<h1>This is a Heading #3</h1>


<p>And I am paragraph</p>

<!-- This is a comment and I am not visible in the browser -->

<ol>
<li>
Ordered List Item #1
</li>
<li>
Ordered List Item #2
</li>
</ol>

<ul>
<li>
UnOrdered List Item #1
</li>
<li>
Ordered List Item #2
</li>
</ul>
  
<a href="https://www.google.com">I am a link to Google </a> <br>
<a href="https://www.uber.com">I am a link to Uber </a> <br>
<a href="https://www.tesla.com">I am a link to Tesla </a> <br>

Current Date and Time is: {{ datevar }}

</body>
</html>

######## Output #########


Related Solutions

Make a modest or simple Web page using Python flask. The basic components of HTML should...
Make a modest or simple Web page using Python flask. The basic components of HTML should be included. The Web page should have at least 3 Headings(<h1>), paragraph (<p>), comments (<!-- -->), ordered list, unordered list, three links to website, and should display time & date. Example: <html>     <head>         <title>Page Title</title>     </head> <body>     ..new page content.. </body> </html>
1 -​Create the code to generate a default web page. The contents of this page should...
1 -​Create the code to generate a default web page. The contents of this page should be Your​​Name, right justified
2 -​Create the code to generate a web page that contains a table. The table should...
2 -​Create the code to generate a web page that contains a table. The table should have 4 ​columns and 4 rows. Each cell should be 100 pixels wide by 100 pixels high. The border ​should be 2 ​pixels.
Using HTML: Create a Book of the Month Club Web site. The home page should describe...
Using HTML: Create a Book of the Month Club Web site. The home page should describe the current month's selection, including book title, author, publisher, ISBN, and the number of pages. Create separate Web pages for book selections in each of the last three months. Add links to the home page that opens each of the three Web pages. Save the home page as BookClub.html, and save the Web Pages for previous months using the name of the month. BOOK:...
1. An HTML document that’s generated by a web application is a ________________________ web page. 2....
1. An HTML document that’s generated by a web application is a ________________________ web page. 2. An easy way to log the progress of an application in Chrome’s Console panel is to insert __________________ methods at critical points in the code. 3. The childNodes property of a DOM object returns a/an ______________________ of the child nodes for that object. 4. The ___________________ method of an array can be used to concatenate the elements of the array into a single string.​...
Using Python programming, make a form that allows user to login to a modest web application...
Using Python programming, make a form that allows user to login to a modest web application that has a password and username with a file that has validated user. Once logged in, a formal greeting and the choice to change password should be available. The password should be strong(NIST SP 800-63B). All failed logins should be logged w/ date and Time. (Ex. 6 failed logins in 20 min dated 12 Jan 2020.
Week 4 Assignment HTML – Creating a Simple Web Page “HTML or HyperText Markup Language as...
Week 4 Assignment HTML – Creating a Simple Web Page “HTML or HyperText Markup Language as it is formally known is the main markup language for creating web pages and other information that can be displayed in a webbrowser”. It was created by Tim Berners-Lee in 1989 as a user friendly way of sharing information on the Internet. http://en.wikipedia.org/wiki/HTML Assignment Instructions - Create a simple HTML Web Page that includes hyperlinks to three of your favorite websites. Use the online...
Develop a personal web page for yourself using HTML, CSS, and Javascript Use the following HTML...
Develop a personal web page for yourself using HTML, CSS, and Javascript Use the following HTML tags to design your webpage: <h1>...</h1>,<h3>...</h3>, <h6>...</h6>, <p>...</p>, <b>...</b>, <i>...</i>, <a>...</a>, <img...>, <table>... </table>, <div>...</div>, <form>...</form>, <input type="text">, and <input type= "submit"> Use an external css to change the default style of your webpage. You must use at least one element selector, one id selector, and one class selector Using text input and submit button, allow the user to change the background color of...
use CSS, java and HTML to make a charity admin page. It's a web page after...
use CSS, java and HTML to make a charity admin page. It's a web page after you log in to your account. I can have personal information, the amount of money donated, the children who have received charity, and some blogs. In fact, all the things are what I want. But you are free to do whatever You like, even if you don't say what I say. I just need a charity Admin page for charity User.Don't ask me for...
use CSS, java and HTML to make a charity admin page. It's a web page after...
use CSS, java and HTML to make a charity admin page. It's a web page after you log in to your account. I can have personal information, the amount of money donated, the children who have received charity, and some blogs. In fact, all the things are what I want. But you are free to do whatever You like, even if you don't say what I say. I just need a charity Admin page for charity User.Don't ask me for...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT