Flask入门教程复原完整的开发流程 只提供入门所需的最少信息 优化术语解释,更容易理解 阅读方法 本书复原了编写这个 Watchlist 程序的完整流程,包括每一行代码块,每一个需要 执行的命令。在阅读时,你需要自己输入每一个代码和命令,检查输出是否和书中 一致。在这个过程中,你也可以对它进行一些调整。比如,示例程序的界面语言使 用了英文,你可以修改为中文或是其他语言。对于页面布局和样式,你也可以自由 修改。 Chrome。 使用命令行 在本书中,你需要使用命令行窗口来执行许多操作。你可以使用 Windows 下的 cmd.exe,或是 macOS 和 Linux 下的终端(Terminal)。下面我们执行一个最简单 的 whoami 命令(即 Who Am I?): $ whoami greyli 这个命令会打印出当前计算机用户的名称。其他常用的命令还有 cd 命令,用来 切换目录(change 切换目录(change directory); mkdir 命令,用来创建目录(make directory)。在不同的操作系统上,执行某个操作的命令可能会有所不同,在必要 的地方,书里会进行提示。 我们先来为我们的程序创建一个文件夹: $ mkdir watchlist $ cd watchlist 除非特别说明,从现在开始,本书假设你的工作目录将是在项目的根目录,即 watchlist/0 码力 | 127 页 | 7.62 MB | 1 年前3
Flask Documentation (1.1.x)this: /home/user/Projects/flask-tutorial ├── flaskr/ │ ├── __init__.py │ ├── db.py │ ├── schema.sql │ ├── auth.py │ ├── blog.py │ ├── templates/ │ │ ├── base.html │ │ ├── auth/ │ │ └── update.html │ └── static/ │ └── style.css ├── tests/ │ ├── conftest.py │ ├── data.sql │ ├── test_factory.py │ ├── test_db.py │ ├── test_auth.py │ └── test_blog.py ├── venv/ ├── become big, you may want to switch to a different database. The tutorial doesn’t go into detail about SQL. If you are not familiar with it, the SQLite docs describe the language [https://sqlite.org/lang.html]0 码力 | 428 页 | 895.98 KB | 1 年前3
Flask Documentation (1.1.x)__init__.py db.py schema.sql auth.py blog.py templates/ base.html auth/ login.html register.html blog/ create.html index.html update.html static/ style.css tests/ conftest.py data.sql test_factory.py test_db become big, you may want to switch to a different database. The tutorial doesn’t go into detail about SQL. If you are not familiar with it, the SQLite docs describe the language. Connect to the Database user table, and posts in the post table. Create a file with the SQL commands needed to create empty tables: Listing 5: flaskr/schema.sql DROP TABLE IF EXISTS user; DROP TABLE IF EXISTS post; (continues0 码力 | 291 页 | 1.25 MB | 1 年前3
共 3 条
- 1













