Python Heroku应用程序部署 - 与buildpack不兼容

时间:2018-01-29 07:02:47

标签: python django git heroku

我正在尝试在Heroku中部署一个简单的“Hello World”Python应用程序,但它告诉我部署与buildpack不兼容。我试图在以前类似的情况下搜索解决方案,并做了所有的事情(例如包括runtime.txt,requirements.txt等),其他人可以最终解决他们的问题,但我仍然有这个错误消息。

请您协助解释为什么会发生这种情况以及如何解决这个问题?很多人!

我做了什么: -

  1. 创建了hello_4.py
  2. 在cmd中,转到相应的文件夹,然后运行“python hello_4.py”并使用浏览器转到http://localhost:5000/
  3. Hello world消息已成功显示
  4. Ctrl + C停止localhost
  5. $ git init
  6. 看到了创建的.git文件夹
  7. $ git add。
  8. $ git commit -m“initial commit 4”
  9. $ pip freeze> requirements.txt
  10. 在1行中创建了Procfile:web:gunicorn hello_4:app
  11. 在1行中创建runtime.txt:python_version =“3.6.3”
  12. $ heroku create mthd010 --buildpack heroku / python
  13. 成功无错误消息。在Heroku网站上刷新仪表板,并看到创建了mthd010应用程序
  14. $ git push heroku master
  15. [出现错误消息]
  16. 我的错误讯息:Image 1

    requirements.txt:Image 2

    runtime.txt:

    python_version = "3.6.3"
    

    Procfile:

    web: gunicorn hello_4:app
    

    hello_4.py:

    from flask import Flask
    app = Flask(__name__)
    @app.route('/')
    def source():
        html = 'Hello World!'
        return html
    if __name__ == '__main__':
        app.run()
    

1 个答案:

答案 0 :(得分:0)

前几天我终于解决了。问题主要是由于runtime.txt。

更新的runtime.txt: -

python-3.6.4
相关问题