https://github.com/un4gt/flask_tutorial
https://flask.palletsprojects.com/en/2.2.x/quickstart/ 代码
https://github.com/un4gt/flask_tutorial
Last synced: 3 months ago
JSON representation
https://flask.palletsprojects.com/en/2.2.x/quickstart/ 代码
- Host: GitHub
- URL: https://github.com/un4gt/flask_tutorial
- Owner: un4gt
- Created: 2022-10-19T03:32:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T02:05:30.000Z (over 2 years ago)
- Last Synced: 2025-02-15T06:23:39.643Z (4 months ago)
- Language: Python
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# flask_tutorial
https://flask.palletsprojects.com/en/2.2.x/quickstart/ 代码## 运行
将代码克隆到本地以并进入`flask_tutorial`目录后,运行下面命令安装所需依赖包
`pip install -r requirements.txt`等安装完所需依赖后,运行一下命令,以开发模式启动
```
flask --app flaskr --debug run
```
出现以下输出,则表明成功运行
```
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with watchdog (windowsapi)
* Debugger is active!
* Debugger PIN: 231-118-413
```打开浏览器后,会出现下面情况

这是因为还未初始化数据库导致的。所有需要先初始化数据库,命令如下:
```
$ flask --app flaskr init-db
Initialized the database.
```
然后再次运行启动命令即可。
其他更详细的内容,请查看 [Tutorial — Flask Documentation (2.2.x)](https://flask.palletsprojects.com/en/2.2.x/tutorial/)