Skip to content

Commit 864c8fe

Browse files
authored
Merge pull request #38 from helloflask/v4
Update for 4th edition
2 parents 614626b + 7e19002 commit 864c8fe

39 files changed

+1612
-913
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ _ebook
44
env
55
venv
66
site
7+
.obsidian

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 4.0
4+
5+
Released: 2025/10/12
6+
7+
- 增加对 uv 的介绍
8+
- 升级到 SQLAlchemy 2.x
9+
- 针对 Flask 3.1.x 进行内容更新
10+
- 增加对蓝本、工厂函数的介绍
311

412
## 3.0
513

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Flask 入门教程
22

3-
这里是《Flask 入门教程》的源码仓库。请访问[本书主页](http://helloflask.com/book/3)在线阅读或下载电子书文件。
3+
> 使用 Python 和 Flask 开发你的第一个 Web 程序
4+
5+
这里是《Flask 入门教程》的源码仓库。请访问[本书主页](http://helloflask.com/book/3)在线阅读本书。
46

57
如果你发现了书中的错误,或是有任何意见或建议,欢迎[创建 Issue](https://github.com/helloflask/flask-tutorial/issues/new) 反馈或提交 Pull Request 进行修正。对于较大的内容变动,建议先[创建 Issue](https://github.com/helloflask/flask-tutorial/issues/new) 进行讨论。谢谢!
68

79
![](http://helloflask.com/static/tutorial-cover-s.png)
810

9-
© 2018 [李辉](http://greyli.com)(Grey Li) / [HelloFlask.com](http://helloflask.com)
11+
© 2018 - 2025 [李辉](http://greyli.com)(Grey Li) / [HelloFlask](http://helloflask.com)
1012

1113
本书采用 [CC BY-NC-ND 3.0](https://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh) 协议授权,禁止商用、演绎后分发或无署名转载。

book.json

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# 第 1 章:代码清单
2+
3+
每一章后面都会有一个代码清单章节,这里会列出上一章所有的代码变动和相关命令。本章的目的是提供一个更清晰的代码改动列表,供你在编写代码时作为参考。
4+
5+
## 目录
6+
7+
```text
8+
watchlist/
9+
├── .venv/
10+
├── .git/
11+
└── .gitignore
12+
```
13+
14+
## 代码
15+
16+
### .gitignore
17+
18+
```text
19+
*.pyc
20+
*~
21+
__pycache__
22+
.DS_Store
23+
.venv
24+
```
25+
26+
## 命令
27+
28+
### 创建项目文件夹
29+
30+
```bash
31+
$ mkdir watchlist
32+
$ cd watchlist
33+
```
34+
35+
### 设置 Git 身份信息
36+
37+
```bash
38+
$ git config --global user.name "Your Name" # 替换成你的名字
39+
$ git config --global user.email "[email protected]" # 替换成你的邮箱地址
40+
```
41+
42+
### 初始化 Git 仓库
43+
44+
```bash
45+
$ git init
46+
Initialized empty Git repository in ~/watchlist/.git/
47+
```
48+
49+
### 创建 .gitignore 文件
50+
51+
```bash
52+
$ nano .gitignore
53+
```
54+
55+
### 生成 SSH 密钥
56+
57+
```bash
58+
$ ssh-keygen -t ed25519 -C "[email protected]"
59+
$ cat ~/.ssh/id_ed25519.pub
60+
```
61+
62+
### 设置远程仓库
63+
64+
```bash
65+
$ git remote add origin [email protected]:greyli/watchlist.git # 注意更换地址中的用户名
66+
```
67+
68+
### 创建虚拟环境
69+
70+
```bash
71+
$ python -m venv .venv # Windows
72+
```
73+
74+
或:
75+
76+
```bash
77+
$ python3 -m venv .venv # Linux 和 macOS
78+
```
79+
80+
### 激活虚拟环境
81+
82+
```bash
83+
$ .venv\Scripts\activate # Windows
84+
```
85+
86+
或:
87+
88+
```bash
89+
$ source .venv/bin/activate # Linux 或 macOS
90+
```
91+
92+
### 安装 Flask
93+
94+
```bash
95+
(.venv) $ pip install flask
96+
```
97+
98+
### 提交代码
99+
100+
```bash
101+
$ git add .
102+
$ git commit -m "Init the project"
103+
$ git push -u origin main
104+
```

0 commit comments

Comments
 (0)