Python writes a simple HTML landing page (1)

Source: Internet
Author: User

1 HTML open mode effect is as follows

2 Writing in Python background

# Coding:utf-8
# import multiple tools from the same location,
# These tools can be separated by commas and imported
# Render_template Render Master
From flask Import Flask,render_template

App=flask (__name__)
# adorners, which are used to encapsulate links while returning data
@app. Route ('/index ')
Def index_xxx ():
# import HTML
# need to create a Templates folder on the desktop,
# put the HTML into this folder
Return render_template (' home1.html ')
# in the function, as long as the code behind the import Return,return is not executed.
Return ' python!! '
@app. Route ('/login ')
def login ():
# import HTML
# return Render_template (' home.html ')
# in the function, as long as the code behind the import Return,return is not executed.
Return ' python!! '

App.debug=true
# Run Server
App.run ()
# if it's an absolute path, create a folder templates,
# because the default is this one folder

3. And also use vs code to write the basic page shown in the foreground

<body><div> Welcome to Jaoany's Blog! </div> <!--action= "/commit" is the link to access the landing page--><form action= "/commit" ><!--<div>html is the front </div>--><input type= "text" name= "username" placeholder= "Please enter user name:" ><input type= "password" name= " PSW "placeholder=" Please enter the password: "><input type=" submit "value=" Login ">
</form> </body> 4 Writing background and foreground environment Subline Text 2 is written in the background, VS code is writing the foreground

Python writes a simple HTML landing page (1)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.