Files
wagtailcms/deploy/windows/serve-backend.ps1
T
Zhengen 1686794ad7 部署配置:新增 Windows Server 裸机部署流程
- requirements/production-windows.txt:Windows 专用生产依赖,用 waitress 替代
  不支持 Windows 的 gunicorn
- deploy/windows/serve-backend.ps1:waitress WSGI 启动脚本
- deploy/windows/install-nssm-services.ps1:用 NSSM 将前后端注册为 Windows 服务
- deploy/windows/nginx-wagtailcms.conf:nginx for Windows 反向代理模板(TCP 端口,
  不用 unix socket)
- documents/Windows服务器部署指南.md:完整部署步骤文档,并说明与 Linux 裸机
  部署(systemd/gunicorn/unix socket/Redis)的差异点
2026-09-11 09:39:30 +08:00

22 lines
914 B
PowerShell

# 后端 WSGI 启动脚本(waitress,供 NSSM 注册为 Windows 服务时调用)。
#
# 用法(供 NSSM 服务的 Application 字段指向):
# powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\wagtailcms\deploy\windows\serve-backend.ps1
#
# 也可以直接双击/命令行手动运行,用于本地验证生产配置是否能正常启动。
$ErrorActionPreference = "Stop"
# 仓库根目录(本脚本位于 <repo>\deploy\windows\ 下)
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
Set-Location $RepoRoot
$env:DJANGO_SETTINGS_MODULE = "wagtailcms.settings.production"
$python = Join-Path $RepoRoot ".venv\Scripts\python.exe"
if (-not (Test-Path $python)) {
throw "找不到虚拟环境解释器:$python,请先创建虚拟环境并安装 requirements/production-windows.txt"
}
& $python -m waitress --listen=127.0.0.1:8000 --threads=8 wagtailcms.wsgi:application