Miguel Grinberg
拥有25年开发经验的高级软件工程师,目前为广播公司开发视频软件。他常在个人博客(blog.miguelgrinberg.com)上撰写各类博文,内容主要涉及Web开发、机器人技术、摄影,偶尔也会有一些影评。他和妻子、四个孩子、两只狗和一只猫共同生活在俄勒冈州波特兰市。Twitter:@miguelgrinberg。
AI导读
核心看点
系统讲解Flask框架基础与最佳实践
通过博客项目实战串联知识点
涵盖数据库、认证及部署全流程
读者共识
内容详实,是Flask入门经典教材
翻译质量参差不齐,阅读需耐心
项目驱动式教学,实战指导性强
精彩摘录
"To start using the virtual environment, you have to “activate” it. If you are using a bash command line (Linux and Mac OS X users), you can activate the virtual environment with this command:"
"When a virtual environment is activated, the location of its Python interpreter is added to the PATH, but this change is not permanent; it affects only your current command session. To remind you that you have activated a virtual environment, the activation command modifies the command prompt to inc"
"When you are done working with the virtual environment and want to return to the global Python interpreter, type deactivate at the command prompt."
"The name argument that is passed to the Flask application construc‐ tor is a source of confusion among new Flask developers. Flask uses this argument to determine the root path of the application so that it later can find resource files relative to the location of the application."
"PyCharm 2016.1 or 2016.2:Settings,Tools,Terminal, and add""/K <path-to-your-activate.bat>""toShell path and add (mind the quotes). Also add quotes around cmd.exe, resulting in: `"cmd.exe" /k ""C:\mypath\my-venv\Scripts\activate.bat""`"
"Web服务器网关接口(Python Web Server Gateway Interface,缩写为WSGI)是为Python语言定义的Web服务器和Web应用程序或框架之间的一种简单而通用的接口。自从WSGI被开发出来以后,许多其它语言中也出现了类似接口。WSGI是作为Web服务器与Web应用程序或应用框架之间的一种低级别的接口,以提升可移植Web应用开发的共同点。WSGI是基于现存的CGI标准而设计的。 WSGI区分为两个部份:一为“服务器”或“网关”,另一为“应用程序”或“应用框架”。在处理一个WSGI请求时,服务器会为应用程序提供环境资讯及一个回呼函数(Callback Functio"
"Why is that? The application will work even with __name__, thanks to how resources are looked up. However it will make debugging more painful. Certain extensions can make assumptions based on the import name of your application. For example the Flask-SQLAlchemy extension will look for the code in yo"