Cloudflare Pages Deploy (Python deployer pattern)

Status: Active Tags: Deployment Infrastructure Service Created: 2026-08-30 Related: local-llm-stack

Definition

The deploy pipeline used for all Cloudflare Pages static sites on this host: a Python deployer (pages_deploy.py) driven by a dedicated venv, because the standard wrangler CLI does not work in this environment.

How It Works

.venv-pages/bin/python pages_deploy.py <project> <dir>
  • venv: /home/romain/workspace/.venv-pages/
  • Deployer: /home/romain/workspace/pages_deploy.py
  • Uploads the static dir to the named Cloudflare Pages project via the API token in the environment.

Key Parameters

ProjectSiteSource dir
newsnews.meiyoucheveux.com/home/romain/workspace/news-deploy/
edu (edu-6qv)edu.meiyoucheveux.com/home/romain/workspace/superdevoirs/
dealsdeals.meiyoucheveux.com/home/romain/deals-site/

When To Use

  • Any redeploy of the above Pages projects (or a new one once created in the dashboard).

Risks & Pitfalls

  • Never run npx wrangler — in this sandbox the network strips the Authorization header from Node.js requests, so wrangler always fails. Always use the Python deployer.
  • The upload endpoint occasionally returns transient 1101 errors; the deployer retries, but if it still fails retry once after ~30 s.
  • Custom-domain attachment is DASHBOARD-only: the cfat_ token cannot write zone DNS (error 10000). Domain ↔ project mapping must be done in the Cloudflare UI.
  • After deploy, verify with curl -s -o /dev/null -w '%{http_code}' https://<domain>/ (expect 200) and grep a known string in the page source.

Sources

  • Cron job prompts for news/deals sites (deploy steps + pitfalls)
  • /home/romain/workspace/pages_deploy.py, .venv-pages/