快速入门指南
¥Quick Start Guide
Strapi 提供了很大的灵活性。无论你是想快速查看最终结果,还是想更深入地了解产品,我们都能满足你的需求。对于本教程,我们将采用 DIY 方法,从头开始构建项目和内容结构,然后将项目部署到 Strapi Cloud 以从那里添加数据。
¥Strapi offers a lot of flexibility. Whether you want to go fast and quickly see the final result, or would rather dive deeper into the product, we got you covered. For this tutorial, we'll go for the DIY approach and build a project and content structure from scratch, then deploy your project to Strapi Cloud to add data from there.
预计完成时间:5-10 分钟
¥Estimated completion time: 5-10 minutes
在安装 Strapi 之前,你的计算机上必须安装以下要求:
¥Before installing Strapi, the following requirements must be installed on your computer:
-
Node.js:仅支持 活动 LTS 或维护 LTS 版本(目前支持
v20
和v22
)。不支持 Node 的奇数版本(称为 Node.js 的 "current" 版本)(例如 v21、v23)。¥Node.js: Only Active LTS or Maintenance LTS versions are supported (currently
v20
andv22
). Odd-number releases of Node, known as "current" versions of Node.js, are not supported (e.g. v21, v23). -
你首选的 Node.js 包管理器:
¥Your preferred Node.js package manager:
-
Python(如果使用 SQLite 数据库)
¥Python (if using a SQLite database)
你还需要 安装 `git` 并拥有一个 GitHub 账户才能将你的项目部署到 Strapi Cloud。
¥You will also need to install `git` and to have a GitHub account to deploy your project to Strapi Cloud.
A 部分:使用 Strapi 创建一个新项目
¥ Part A: Create a new project with Strapi
我们将首先通过在终端中运行命令在你的计算机上创建一个新的 Strapi 项目,然后注册我们的第一个本地管理员用户。
¥We will first create a new Strapi project on your machine by running a command in the terminal, and then register our first local administrator user.
按照以下步骤操作,单击可切换的内容以阅读更多说明。
¥Follow the steps below by clicking on the togglable content to read more instructions.
Step 1: Run the installation script and create a Strapi Cloud account
步骤 1:运行安装脚本并创建 Strapi Cloud 账户
¥Step 1: Run the installation script and create a Strapi Cloud account
-
在终端中运行以下命令:
¥Run the following command in a terminal:
```bash
npx create-strapi@latest my-strapi-project
```
-
终端会邀请你创建一个 Strapi Cloud 账户。确保在终端中选择了
Login/Sign up
,或使用箭头键选择它,然后按 Enter。¥The terminal will invite you to create a Strapi Cloud account. Ensure
Login/Sign up
is selected in the terminal, or use arrow keys to select it, and press Enter. -
在打开的新浏览器选项卡中,确保确认码与终端中的确认码相同,然后单击确认。
¥In the new browser tab that opens, ensure the confirmation code is the same as in the terminal and click Confirm.
-
仍在浏览器选项卡中,单击“继续使用 GitHub”。如果你尚未使用当前浏览器会话登录 GitHub,你可能会被重定向到 GitHub 登录页面。
¥Still in the browser tab, click Continue with GitHub. If you are not already logged in into GitHub with your current browser session, you might be redirected to a GitHub login page.
-
登录后,浏览器将显示 "恭喜,你已全部设置完毕!" 消息,你可以安全地关闭浏览器选项卡并返回终端。
¥Once logged in, the browser will display a "Congratulations, you're all set!" message and you can safely close the browser tab and get back to the terminal.


-
终端现在会问你几个问题。在 REST API 返回的响应中填充
Enter
和 字段(有关更多详细信息,请参阅 )。
默认值:¥The terminal will now ask you a few questions. Press
Enter
to accept the default answer to all questions.
正如你在终端中看到的,你的项目现在正在本地构建。
¥As you will see in the terminal, your project is now building locally.
-
你的项目文件夹将包含一个
.strapi-cloud.json
文件,用于将你机器上的本地 Strapi 项目链接到 Strapi Cloud 项目。¥The folder of your project will include a
.strapi-cloud.json
file used to link the local Strapi project on your machine to the Strapi Cloud project. -
还有更多安装选项可用。详情请参阅 安装文档。
¥Many more installation options are available. Please refer to the installation documentation for details.