1、安装flask包
C:\Users\DJL>pip install flask
Collecting flask
Using cached Flask-2.0.1-py3-none-any.whl (94 kB)
Collecting itsdangerous>=2.0
Using cached itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting Werkzeug>=2.0
Using cached Werkzeug-2.0.1-py3-none-any.whl (288 kB)
Collecting click>=7.1.2
Using cached click-8.0.1-py3-none-any.whl (97 kB)
Collecting Jinja2>=3.0
Using cached Jinja2-3.0.1-py3-none-any.whl (133 kB)
Requirement already satisfied: colorama; platform_system == "Windows" in c:\users\djl\appdata\local\programs\python\python38\lib\site-packages (from click>=7.1.2->flask) (0.4.4)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl (14 kB)
Installing collected packages: itsdangerous, Werkzeug, click, MarkupSafe, Jinja2, flask
Successfully installed Jinja2-3.0.1 MarkupSafe-2.0.1 Werkzeug-2.0.1 click-8.0.1 flask-2.0.1 itsdangerous-2.0.1
WARNING: You are using pip version 20.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'c:\users\djl\appdata\local\programs\python\python38\python.exe -m pip install --upgrade pip' command.
2、看到succfully就ok了。
3、打开pycharm。新建flask项目
4、运行app.py。控制台输出如下:
FLASK_APP = app.py
FLASK_ENV = development
FLASK_DEBUG = 0
In folder D:/pycharm/20211001
D:\pycharm\20211001\venv\Scripts\python.exe -m flask run
* Serving Flask app 'app.py' (lazy loading)
* Environment: development
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
5、浏览器访问给出的地址(http://127.0.0.1:5000/)
出现hello就算是成功了!?
|