问题
I am trying to deploy my python flask app to heroku but it keeps crashing and complaining about bash: gunicorn: command not found
. I have my requirement.txt
file in the root folder where my Procfile
is also located. My python code is located in src/server/
Procfile contains: web: gunicorn --pythonpath src/server/ route:app --preload
I have gunicorn in my requirements file:
Is there something i'm missing?
gunicorn==19.8.1
Flask==0.12.2
Flask-Cache==0.13.1
Flask-Cors==3.0.2
Flask-MongoAlchemy==0.5.1
flask-mongoengine==0.9.5
Flask-PyMongo==0.5.2
Flask-WTF==0.14.2
gevent==1.2.1
greenlet==0.4.12
pymongo==3.6.1
folder structure;
回答1:
I faced a similar problem with my app. I just reset all my requirements by sending in an empty requirements.txt
file. Then built my app. Then sent the original file. I don't understand why, but it worked.
回答2:
I am also having a similar problem like this on Heroku. I created an IDENTICAL new project and magically it works. Heroku has some bug related to ignoring requirements.txt
回答3:
I fixed it by creating a new environment in Heroku. The previous environment seems not to be reading the requirement.txt file, I couldn't figure why.
来源:https://stackoverflow.com/questions/50602030/heroku-not-reading-requirement-txt-file