因此,我尝试使用scrapyd将python网络抓取项目推到heroku,我下载了heroku cli并在平台上注册了免费帐户。 我也配置了git。 在将代码部署到heroku时,我进行了以下更改:
我在我编写的项目的根目录中创建了Procfile:
web: scrapyd
我使用以下命令在项目的根目录中创建了requirements.txt:
pip freeze > requirements.txt
在命令行中。
我还使用以下代码创建了runtime.txt:
python-3.7.7
和.gitignore文件:
__pycache__/
.vscode/
build/
dbs/
eggs/
project.egg-info/
*.json
*.csv
无论如何,当我尝试:
git push heroku master
运行:
之后 heroku git:remote -a appname
命令行(和构建日志)显示以下错误:
-----> Python app detected
! Requested runtime () is not available for this stack (heroku-18).
! Aborting. More info: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
我尝试多次更改runtime.txt中指定的python版本,甚至尝试删除该文件,然后完全运行部署,这是行不通的。