flask-tutorial
flask-tutorial copied to clipboard
Flask 入门教程 / Flask for Beginners
- Remove `FLASK_ENV` - Introduce `--app` and `--debug` options
尝试使用下面的工具生成 PDF 文件: - https://github.com/fuergaosi233/gitbook2pdf - https://github.com/orzih/mkdocs-with-pdf
**太痛苦了**一般教程都没讲这个
## 使用命令:flask shell 出现如下图报错:  ## 网上查阅的资料: `地址`:https://stackoverflow.com/questions/73340344/cannot-use-module-aioflaskpython-importerror-cannot-import-name-app-ctx-st  ## 困惑 次教程是flask3.0X版本,是需要降低flask版本吗?
章节:第9章 位置:test_watchlist.py:测试认证相关功能 ``` class WatchlistTestCase(unittest.TestCase): # ... # 测试登录保护 def test_login_protect(self): response = self.client.get('/') data = response.get_data(as_text=True) self.assertNotIn('Logout', data) ...... ``` 这个测试用例不会通过,原因猜测可能是存在登录的缓存,我看了返回的html是登录过后的。于是我在前面加了个logout的方法,并且在这段代码前使用,即可通过测试: ``` def logout(self): self.client.get('/logout') ...... def test_login_protect(self): self.logout()...
- Consider introducing app factory to make testing easier. - Remove the pinned version in #27
“目前它在 GitHub 上是 Star 数量最多的 Python Web 框架,没有之一” 大约在2021年被超了 😂 https://star-history.com/#django/django&pallets/flask&Date