展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

flask配置

  • 安装依赖
(C:\ProgramData\Anaconda3) C:\Users\ychen>pip install flask==2.0.1
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting flask==2.0.1
  Downloading https://mirrors.aliyun.com/pypi/packages/54/4f/1b294c1a4ab7b2ad5ca5fc4a9a65a22ef1ac48be126289d97668852d4ab3/Flask-2.0.1-py3-none-any.whl (94 kB)
     |████████████████████████████████| 94 kB 547 kB/s
Collecting Werkzeug>=2.0
  Downloading https://mirrors.aliyun.com/pypi/packages/f4/f3/22afbdb20cc4654b10c98043414a14057cd27fdba9d4ae61cea596000ba2/Werkzeug-2.0.3-py3-none-any.whl (289 kB)
     |████████████████████████████████| 289 kB 595 kB/s
Collecting Jinja2>=3.0
  Downloading https://mirrors.aliyun.com/pypi/packages/20/9a/e5d9ec41927401e41aea8af6d16e78b5e612bca4699d417f646a9610a076/Jinja2-3.0.3-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 409 kB/s
Requirement already satisfied: click>=7.1.2 in c:\programdata\anaconda3\lib\site-packages (from flask==2.0.1) (8.0.4)
Collecting itsdangerous>=2.0
  Downloading https://mirrors.aliyun.com/pypi/packages/9c/96/26f935afba9cd6140216da5add223a0c465b99d0f112b68a4ca426441019/itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Requirement already satisfied: importlib-metadata in c:\programdata\anaconda3\lib\site-packages (from click>=7.1.2->flask==2.0.1) (4.8.3)
Requirement already satisfied: colorama in c:\programdata\anaconda3\lib\site-packages (from click>=7.1.2->flask==2.0.1) (0.4.5)
Collecting MarkupSafe>=2.0
  Downloading https://mirrors.aliyun.com/pypi/packages/73/60/296031f365b3ae96732225203d864fac7b83a185ed1820c1c87b78e154bc/MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl (14 kB)
Requirement already satisfied: dataclasses in c:\programdata\anaconda3\lib\site-packages (from Werkzeug>=2.0->flask==2.0.1) (0.8)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\programdata\anaconda3\lib\site-packages (from importlib-metadata->click>=7.1.2->flask==2.0.1) (4.1.1)
Requirement already satisfied: zipp>=0.5 in c:\programdata\anaconda3\lib\site-packages (from importlib-metadata->click>=7.1.2->flask==2.0.1) (3.6.0)
Installing collected packages: MarkupSafe, Werkzeug, Jinja2, itsdangerous, flask
  Attempting uninstall: MarkupSafe
    Found existing installation: MarkupSafe 1.0
    Uninstalling MarkupSafe-1.0:
      Successfully uninstalled MarkupSafe-1.0
  Attempting uninstall: Werkzeug
    Found existing installation: Werkzeug 0.12.2
    Uninstalling Werkzeug-0.12.2:
      Successfully uninstalled Werkzeug-0.12.2
  Attempting uninstall: Jinja2
    Found existing installation: Jinja2 2.9.6
    Uninstalling Jinja2-2.9.6:
      Successfully uninstalled Jinja2-2.9.6
  Attempting uninstall: itsdangerous
    Found existing installation: itsdangerous 0.24
    Uninstalling itsdangerous-0.24:
      Successfully uninstalled itsdangerous-0.24
  Attempting uninstall: flask
    Found existing installation: Flask 0.12.2
    Uninstalling Flask-0.12.2:
      Successfully uninstalled Flask-0.12.2
Successfully installed Jinja2-3.0.3 MarkupSafe-2.0.1 Werkzeug-2.0.3 flask-2.0.1 itsdangerous-2.0.1
  • 新建项目

  • 开启debug,每次修改后不用重启项目

  • 社区版pycharm开启debug

if __name__ == '__main__':
    app.run(debug=True)
  • 修改host,让其他电脑也可访问

  • 修改端口号

--host=0.0.0.0 --port=8000
posted @ 2024-03-19 14:52  DogLeftover  阅读(18)  评论(0编辑  收藏  举报