2016-08-05 56 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