本文主要是介绍计算机英语讲课笔记11(Play with Flask),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
文章目录
- 1. Flask's Documentation
- 2. Installation of Flask
- (1) Create an environment
- (2) Activate the environment
- (3) Install Flask
- 3. Quick Start - 快速起步
- (1) A Minimal Application
- (2) Create and Visit a Template
1. Flask’s Documentation
- https://flask.palletsprojects.com/en/2.1.x/
2. Installation of Flask
- https://flask.palletsprojects.com/en/2.1.x/installation/
- We recommend using the latest version of Python. The current version of Python is 3.10.5
- Flask supports
Python 3.7 and newer
. - Check the version of Python on your computer.
- It shows that Flask can be used on your computer.
(1) Create an environment
- Look at the instruction in the document.
- Let’s view the directory structure of the project - flaskdemo
(2) Activate the environment
- Look at the instruction in the document.
- We follow the instruction above.
- Type the command and then press the Enter key
(3) Install Flask
- Look at the instruction in the document.
- We follow the instruction above.
- Upgrade
pip
from19.2.3
to22.1.2
3. Quick Start - 快速起步
- https://flask.palletsprojects.com/en/2.1.x/quickstart/
(1) A Minimal Application
- Use PyCharm to open the flask project -
flaskdemo
- Create a Python file named
main.py
- Write the code in the main.py
- Run the program and look at the result.
- Visit
http://localhost:8888
in the browser.
(2) Create and Visit a Template
- Create a template named
welcome.html
- Modify the main.py to create a new router function named
welcome
.
- Run the program again and visit
http://localhost:8888/welcome
in the browser.
这篇关于计算机英语讲课笔记11(Play with Flask)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!