Flask Basics of the Python Framework (iv)--------other operations

Source: Internet
Author: User

1. Blueprint

To manage a project with a blueprint, the package that needs to be imported is: from flask import Buleprint

The concrete is broadly divided into three steps:

1. First import the Blueprint package in the Submodule and then create the Blueprint object.

2. The view functions in the submodule are then stored in the Blueprint object.

3. Finally, register the blueprint in the main module's folder.

The following shows the specific actions of the above three steps in the project, respectively:

The first step:

Step Two:

Step Three:

Using templates in Submodules: Two steps are required.

First:

To set it up in Pycharm first:

Second:

You then need to add the following phrase manually when creating the Blueprint object:

The preceding sentence means adding a prefix to the URL.

Flask Basics of the Python Framework (iv)--------other operations

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.