- Python Pyramid 教程
- Python Pyramid - 首页
- Python Pyramid - 概述
- Pyramid - 环境设置
- Python Pyramid - Hello World
- Pyramid - 应用程序配置
- Python Pyramid - URL 路由
- Python Pyramid - 视图配置
- Python Pyramid - 路由前缀
- Python Pyramid - 模板
- Pyramid - HTML 表单模板
- Python Pyramid - 静态资源
- Python Pyramid - 请求对象
- Python Pyramid - 响应对象
- Python Pyramid - 会话
- Python Pyramid - 事件
- Python Pyramid - 消息闪现
- Pyramid - 使用 SQLAlchemy
- Python Pyramid - Cookiecutter
- Python Pyramid - 创建项目
- Python Pyramid - 项目结构
- Python Pyramid - 包结构
- 手动创建项目
- 命令行 Pyramid
- Python Pyramid - 测试
- Python Pyramid - 日志记录
- Python Pyramid - 安全
- Python Pyramid - 部署
- Python Pyramid 有用资源
- Python Pyramid - 快速指南
- Python Pyramid - 有用资源
- Python Pyramid - 讨论
Python Pyramid - Cookiecutter
到目前为止,我们通过手动执行路由配置、添加视图和使用模板来构建 Pyramid 应用程序。Cookiecutter 提供了一种便捷的替代方案来生成 Pyramid 项目结构。它是一个命令行实用程序,使用某些预定义的项目模板。然后可以微调项目以适应用户可能具有的特定需求。
Cookiecutter 创建的 Python 项目是一个 Python 包。默认的应用程序逻辑可以进一步自定义。如此创建的项目结构具有极强的扩展性,易于分发。
Cookiecutter 实用程序由Audrey Feldroy 开发。它适用于 Python 3.7 及更高版本。Python、JavaScript、Ruby、CoffeeScript、语言或 RST、Markdown、CSS、HTML 脚本中的项目模板可用于生成项目。Github 托管了许多预构建的项目模板,任何一个都可以使用。
从 cookiecutter 模板构建的项目是一个跨平台包。Cookiecutter 项目生成是完全自动化的,您无需为此编写任何代码。一旦调用 cookiecutter 命令,它就会读取正在使用的模板并提示用户为设置参数选择适当的值。首先,使用 PIP 安装程序安装 Cookiecutter。
pip install cookiecutter
要验证 Cookiecutter 是否已正确安装,请运行
>>> import cookiecutter >>> cookiecutter.__version__ '1.7.3'
广告