You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ export FLASK_APP=api.py
$ export FLASK_ENV=development
$ flask run
看到下面的输出,说明运行成功了:
* Serving Flask app "flaskr" (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!* Debugger PIN: 577-682-777
本文约550字,将耗费您约4⃣️分钟~
前期准备
创建一个虚拟环境:
$ mkdir flask_restful $ cd flask_restful $ python3 -m venv venv
激活虚拟环境:
$ . venv/bin/activate
虚拟环境退出:
安装
flask
和flask_restful
:项目接口模拟
在项目的根目录下面新建文件
api.py
,在此文件中进行数据的增删改查。之后运行应用:
看到下面的输出,说明运行成功了:
项目接口验证
在上面的代码中,我们对
users
进行了相关的增删改查,下面我们来验证下:后话
参考:http://www.pythondoc.com/Flask-RESTful/
参考:https://dormousehole.readthedocs.io/en/latest/
更多内容:https://github.com/reng99
微信云开发初体验:https://juejin.cn/post/6937461043169853447
The text was updated successfully, but these errors were encountered: