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

Heroku部署Django应用遇gunicorn: command not found问题求助

Fixing "gunicorn: command not found" on Heroku Django Deployment

Hey there, let's break down why you're hitting this error even though gunicorn is in your requirements.txt!

The Root Cause

Looking at your logs:

2020-02-21T16:22:20.679520+00:00 app[web.1]: bash: gunicorn: command not found

You mentioned you have Pipfile and Pipfile.lock files in your project. Heroku automatically prioritizes Pipenv over pip when it detects these files—meaning it won't use your requirements.txt at all for dependency installation. So even if gunicorn is listed there, it wasn't installed because Heroku used Pipenv instead, and gunicorn is missing from your Pipfile.

Solutions to Try

Option 1: Add gunicorn to your Pipfile

Make sure gunicorn is included in your Pipfile so Heroku installs it via Pipenv:

  • Run this command locally to update your Pipfile and Pipfile.lock:
    pipenv install gunicorn==20.0.4
    
  • Or manually edit your Pipfile, adding this line under the [packages] section:
    gunicorn = "==20.0.4"
    

Then commit the updated Pipfile and Pipfile.lock, and redeploy to Heroku.

Option 2: Switch back to using requirements.txt

If you prefer to stick with requirements.txt instead of Pipenv, simply delete the Pipfile and Pipfile.lock files from your project. Commit this change and redeploy—Heroku will now use pip to install dependencies directly from your requirements.txt, which already includes gunicorn.

Quick Double-Check

Also, take a quick look at your Procfile command:

gunicorn brendan_project.wsgi -- log file-

There's an extra space between -- and log—it should probably be --log-file (or whatever your intended flag is). This might not be causing the current error, but fixing it will prevent issues once gunicorn is installed.

内容的提问来源于stack exchange,提问作者Brendan Gaturu

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.06 19:13:12