2016-08-05 55 views
1

下面是我的燒瓶項目結構。我在heroku上遇到了nltk的問題,所以根據一些文檔,我在我的項目中包含了NLTK數據文件夾,並將所有文件添加到git中並將其推送到heroku。下一次,如果我只是更改app.py文件,並且只想推送app.py,那麼我按照下面的命令顯示。但是每次我做出改變並且只添加一個文件到git中時,提交併推送它就會一直持續下去。只推送一個文件到Heroku的問題

C:\Users\mysys\mywebservices>dir 
Volume in drive C is OSDisk 
Volume Serial Number is B08D-8A75 

Directory of C:\Users\mysys\mywebservices 

08/04/2016 02:18 PM <DIR>   . 
08/04/2016 02:18 PM <DIR>   .. 
08/05/2016 10:40 AM    18 .gitignore 
08/05/2016 12:07 PM    1,546 app.py 
08/03/2016 06:52 PM    369 instructions.txt 
08/03/2016 06:42 PM <DIR>   mywebservices 
08/04/2016 02:30 PM <DIR>   nltk_data 
08/03/2016 06:38 PM    21 Procfile 
08/04/2016 02:33 PM    135 requirements.txt 
       5 File(s)   2,089 bytes 
       4 Dir(s) 12,047,900,672 bytes free 

以下是使用的命令。即使是app.py的小改動,也會推送大量文件。我錯過了什麼,請讓我知道。

C:\Users\mysys\mywebservices>git status 
On branch master 
Your branch is ahead of 'origin/master' by 19 commits. 
    (use "git push" to publish your local commits) 
Changes not staged for commit: 
    (use "git add <file>..." to update what will be committed) 
    (use "git checkout -- <file>..." to discard changes in working directory) 

     modified: app.py 

no changes added to commit (use "git add" and/or "git commit -a") 

C:\Users\mysys\mywebservices>git add app.py 

C:\Users\mysys\mywebservices>git commit -m "testing nltk" 
[master 5990375] testing nltk 
Committer: mysys <[email protected]> 
Your name and email address were configured automatically based 
on your mysys and hostname. Please check that they are accurate. 
You can suppress this message by setting them explicitly: 

    git config --global user.name "Your Name" 
    git config --global user.email [email protected] 

After doing this, you may fix the identity used for this commit with: 

    git commit --amend --reset-author 

1 file changed, 1 insertion(+), 1 deletion(-) 

C:\Users\mysys\mywebservices> 

C:\Users\mysys\mywebservices>git push heroku master 
Counting objects: 23025, done. 
Delta compression using up to 4 threads. 
Compressing objects: 82% (18925/22974) 
+0

你是不是按一個承諾,你是推19個提交:'你的分支進取「的由來/大師」的19 commits.' – 1615903

+0

@ 1615903但什麼是隻更新文件的方式,我可以從heroku向本地做出pull請求並進行更改並再次推送? – yome

回答

0

推到Heroku的通常需要的時間像樣的數目,因爲每次你推到Heroku的時間:

  • 你第一次上傳所有的項目代碼的Heroku。如果你做了很多修改(在這種情況下,你的日誌顯示你正在推送19次提交),那麼你可能會向Heroku推送大量數據。
  • 接下來,Heroku掃描您的項目並運行它們的buildpack腳本。
  • Heroku然後嘗試安裝所有項目依賴關係(即使沒有任何更改)。這可能需要一段時間,取決於您的項目有多少依賴關係。
  • Heroku然後從你完全建造的項目中建立一個'僞'圖像。
  • 然後Heroku將這個僞圖像部署到您正在運行的多個dynos中。
  • Heroku然後刪除您的舊的dynos並在等待設置的超時後用新的dynos替換它們。
+0

thx的解釋。我有大約3GB的nltk_data文件夾。我把這一次上傳到了heroku,而且這個永遠不會再改變。因此,每次我對其他文件進行一些更改時,似乎整個項目都會再次上傳。這使我的開發非常緩慢。 – yome

+0

每次你推送到Heroku時,你都會對你的構建進行增量更改。所以,如果你做了大的修改,導致巨大的二元差異,那麼你將有大量的數據推向Heroku。除了獲得更快的網絡連接,執行更小的更改或更頻繁地執行操作之外,您無能爲力。 – rdegges