[Python] Create a minimal website in Python using the Flask microframework

Source: Internet
Author: User

How-to-install Flask use Flask-Create a minimal website Build routes in Flask-respond to website endpoints use Varia ble Rules to pass parts of the URL to your functions as keyword parameters


Pip Install Flask

Development Mode:


#!/bin/bashexport Flask_app=app.pyexport flask_debug=1FLASK run


 fromFlaskImportFlaskapp= Flask (__name__) @app. Route ('/')defHello_world ():return 'Hello world!'@app. Route ('/foo/')deffoo ():return 'The foo page'@app. Route ('/bar')defBar ():return 'The Bar page'@app. Route ('/hello/') @app. Route ('/hello/<name>')defSay_hello (name=None):return' Hello {} '. Format (user)

[Python] Create a minimal website in Python using the Flask microframework

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.