[英]Heroku/python failed to detect set buildpack
我是Django新手,我創建了一個應用,並希望使用Heroku進行部署。 但是,當我進行git push heroku master
(我遵循Heroku的入門知識),這就是我得到的:
Counting objects: 36, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (33/33), done.
Writing objects: 100% (36/36), 19.22 KiB | 0 bytes/s, done.
Total 36 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy....
remote:
remote: ! Push rejected to dry-waters-63931.
remote:
To https://git.heroku.com/dry-waters-63931.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/dry-waters-63931.git'
我的根目錄:
├── assignment
├── household_management (django app)
├── templates
|
├── db.sqlite3
|
├── manage.py
如果你們能提供幫助,我將不勝感激。 我現在真的很沮喪
您需要添加一個requirements.txt
文件,其中包含運行應用程序所需的所有模塊。
您可以執行pip freeze > requirements.txt
將所有模塊凍結到一個文件中。 我只建議您在使用virtualenv時執行此操作,因為否則它將添加所有模塊。
無論如何,只需確定您的應用程序需要哪些模塊,然后創建一個名為requirements.txt
的文件並將其放在應用程序目錄中即可。
需求文件的語法如下:
package name == version #
package name == version #
package name == version #
注意:指定特定版本號是可選的。
這是示例需求文件(從本教程中獲取):
Flask==0.11
Jinja2==2.8
gunicorn==19.6.0
不要忘記提交您的requirements.txt
您只需要在主應用程序文件夾中添加requirements.txt文件即可。其中包含我們正在處理的軟件包,如django,flask。
以下是逐步解決上述問題的步驟:
在您的應用文件夾中創建一個requirements.txt文件。
從同一文件夾運行命令pip Frozen> requirements.txt。
現在提交您的更改。
git添加
git commit -m“已添加要求”
git push heroku主
在我的情況下,這就是問題所在:我沒有添加任何模塊就這樣做了,因為pip也可以自動從本地代碼庫安裝依賴項。 當我檢查我的require.txt文件時運行命令后,已經有自動添加的模塊。
注意:如果您沒有遇到這種情況,可以按照哈里森在回答中所說的那樣手動進行。
僅當您遇到與我的情況類似的錯誤時,才發現關於conda ==版本的錯誤。 由於模塊是根據我的本地代碼庫自動添加的,因此Conda版本安裝在我的本地計算機上,這就是為什么將其自動添加到我的require.txt文件中的原因。 您所需要做的就是將其從requirements.txt文件中刪除。
再次提交更改。
認為這可能會幫助一些遇到類似錯誤的人。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.