部署Django应用至Heroku遇应用错误求助(附日志信息)
Hey there! Let's work through this crash issue together—your logs make the root cause really clear: bash: gunicorn: command not found (exit status 127). This means Heroku can't locate the gunicorn tool because it never got installed properly in your app's environment.
The Core Problem: Malformed requirements.txt
Looking at your listed dependencies, I spotted a critical formatting issue: you're using Chinese 顿号(、) to separate packages instead of standard English line breaks or commas. Heroku's dependency installer can't parse this non-standard format, so it failed to install gunicorn (and likely other packages too).
Step-by-Step Fix
Rewrite your
requirements.txtcorrectly
The standard (and most readable) format is to list each dependency on its own line. Update yours to look like this:dj-database-url==0.5.0 Django==2.2 django-heroku==0.3.1 gunicorn==19.9.0 psycopg2==2.8.3 pytz==2019.1 sqlparse==0.3.0 whitenoise==4.1.3Commit and push the corrected file to Heroku
Run these commands in your local project folder to deploy the fix:git add requirements.txt git commit -m "Fix requirements.txt format for Heroku compatibility" git push heroku masterRestart your Heroku dyno
A fresh restart ensures the new dependencies are loaded properly:heroku restart
Verify the Fix
After redeploying, you can confirm gunicorn is installed by running:
heroku run pip list
Check the output for gunicorn to make sure it's present in your app's environment.
Quick Double-Check
Also, confirm your Procfile is pointing to the right WSGI module. Your current line web: gunicorn count_project.wsgi is correct only if count_project is the name of your Django project directory (the one containing wsgi.py). If that's not your project's actual name, update the path to match your structure.
Once you've completed these steps, visit your Heroku app again—it should no longer throw the H10 crash error.
内容的提问来源于stack exchange,提问作者scottish_foldington

