hello.py
# start source block
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
	return 'Hello World!'
def main():
	#Web service device for development
	app.run(host='127.0.0.1', port=5678, debug=False)
if __name__ == '__main__':
	#Main function function for adjustment
	main()
# end source block
上面代码保存为hello.py Command line $ python hello.py Residential browser site: http: // localhost: 5678 Normal surface display Hello World!
hello/ --app.py --views/ ----__ init__.py # Action Included ----view_hello.py --templates/ ----view_hello.html
app.py
# start source block
from flask import (
    Flask,
    Blueprint,
)
#Introductory objective view
from views import view_hello
app = Flask(__name__)
#Note: Roots of the city, owned by the object, and owned by the object._url/hello/Appearance
app.register_blueprint(view_hello.app, url_prefix='/hello')
def main():
    #Web service device for development
    app.run(host='127.0.0.1', port=5678, debug=False)
if __name__ == '__main__':
    #Main function function for adjustment
    main()
# end source block
view_hello.py
# start source block
from flask import (
    Flask,
    Blueprint,
    render_template,
)
app = Blueprint(
    'views.hello',
    __name__,
    template_folder='templates',
)
@app.route('/sayhello')
def say_hello():
    page_title = 'hello world'
    page_html = 'view_hello.html'
    res = {
        'page_title': page_title,
        # 'data_lst': data_lst,Other data display number
    }
    return render_template(
        page_html,
        res=res,
    )
# end source block
__init__.py
# start source block
# package
#Comment
# end source block
view_hello.html
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{{res.page_title}}</title>
  </head>
  <body >
The world of luck!
  </body>
</html>
Command line $ python app.py Sightseeing browser site: http: // localhost: 5678 / hello / sayhello Normal surface display Theme: hello world! 页 Surface content: 你子 world!