You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure App Service部署Django应用失败:容器未响应8000端口HTTP探测

Django部署Azure App Service启动失败问题解决

问题场景

本地开发环境运行正常的Django应用,使用以下命令部署至Azure App Service后启动失败:

az webapp up --resource-group test --location australiaeast --plan test-plan-01 --sku B1 --name test-app-01 --runtime PYTHON:3.10

报错日志如下:

2023-07-04T05:25:29.544Z ERROR - Container test-xxxx_0_xxxxxxxx for site test-app-01 has exited, failing site start

2023-07-04T05:25:29.606Z ERROR - Container test-xxxx_0_xxxxxxxx didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.

2023-07-04T05:25:29.612Z INFO  - Stopping site test-app-01 because it failed during startup.*

解决方案

此前项目用WhiteNoise托管静态文件,移除settings.py中的以下配置项后,重新部署即可成功启动:

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

推测原因

CompressedManifestStaticFilesStorage会对静态文件做压缩和哈希命名处理,在Azure App Service容器环境中,可能因静态文件生成路径权限、容器启动阶段静态文件未正确生成等问题,导致应用无法完成初始化,进而无法响应8000端口的健康检测,最终触发容器退出。

内容的提问来源于stack exchange,提问作者J.W

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 03:14:53