コンテンツにスキップ

Pelican

Pelican は、Pythonで書かれた静的サイトジェネレーターです。Pelicanを使用すると、お好みのエディタでreStructuredTextまたはMarkdown形式で直接コンテンツを書くことができます。

Pelicanプロジェクトの作成

まず、Pelicanプロジェクトディレクトリを作成します。新しいディレクトリにcdして、次のコマンドを実行します:

Terminal window
python3 -m pip install pelican

次に、以下のコマンドを実行します:

Terminal window
pip freeze > requirements.txt

プロジェクト内にcontentという名前のディレクトリを作成します:

Terminal window
mkdir content

これはビルドコマンドで設定するディレクトリ名です。

Before you continue

All of the framework guides assume you already have a fundamental understanding of Git. If you are new to Git, refer to this summarized Git handbook on how to set up Git on your local machine.

If you clone with SSH, you must generate SSH keys on each computer you use to push or pull from GitHub.

Refer to the GitHub documentation and Git documentation for more information.

Create a GitHub repository

Create a new GitHub repository by visiting repo.new. After creating a new repository, go to your newly created project directory to prepare and push your local application to GitHub by running the following commands in your terminal:

Terminal window
git init
git remote add origin https://github.com/<your-gh-username>/<repository-name>
git add .
git commit -m "Initial commit"
git branch -M main
git push -u origin main

Cloudflare Pagesへのデプロイ

サイトをPagesにデプロイするには:

  1. Cloudflareダッシュボードにログインし、アカウントを選択します。
  2. アカウントホームで、Workers & Pages > アプリケーションの作成 > Pages > Gitに接続を選択します。
  3. 作成した新しいGitHubリポジトリを選択し、ビルドとデプロイの設定セクションで、_Pelican_をフレームワークプリセットとして選択します。あなたの選択は次の情報を提供します。ビルドコマンドpelican contentは、このガイドで以前に作成したcontentフォルダを指します。
Configuration option Value
Production branch main
Build command pelican content
Build directory output
  1. **環境変数(詳細)**を選択し、PYTHON_VERSION変数に3.7の値を設定します。

Cloudflare Pagesに最初のサイトをデプロイするための完全なガイドについては、始めるガイドを参照してください。

サイトをデプロイした後、*.pages.devでプロジェクトのユニークなサブドメインを受け取ります。

Pelicanサイトに新しいコードをコミットするたびに、Cloudflare Pagesは自動的にプロジェクトを再ビルドしてデプロイします。また、新しいプルリクエストでプレビューのデプロイにアクセスでき、変更が本番環境にデプロイされる前にサイトにどのように表示されるかをプレビューできます。

Learn more

By completing this guide, you have successfully deployed your Pelican site to Cloudflare Pages. To get started with other frameworks, refer to the list of Framework guides.