为什么Heroku没有检测到我的Procfile?

时间:2017-06-20 05:05:17

标签: heroku flask python-3.6

Heroku没有看到我的Procfile并开始安装错误版本的py。

我正在尝试使用Heroku上传一个非常基本的烧瓶应用程序。根据SO的其他建议,我使用命令行创建了Procfile,runtime.txt和requirements.txt,而不是通过编辑器。我还确保它们位于基本的git目录中。当我进入

$ git push heroku master

我得到以下内容:

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote:  !     Warning: Your application is missing a Procfile. This file tells Heroku how to run your application.
remote:  !     Learn more: https://devcenter.heroku.com/articles/procfile
remote: -----> Installing python-2.7.13
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Invalid requirement: 'Python 3.6.1'
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python2.7/site-packages/pip/req/req_install.py", line 82, in __init__
remote:            req = Requirement(req)
remote:          File "/app/.heroku/python/lib/python2.7/site-package/pip/_vendor/packaging/requirements.py", line 96, in __init__
remote:            requirement_string[e.loc:e.loc + 8]))
remote:        InvalidRequirement: Invalid requirement, parse error at "u'3.6.1'"
remote:        
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to salty-springs-82445.
remote: 
To https://git.heroku.com/salty-springs-82445.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/salty-springs 82445.git'

Procfile的内容:

web: python run.py

这是项目结构:

▾ Random_world/                                                          
  ▸ __pycache__/                                                         
  ▾ app/                                                                 
    ▸ __pycache__/                                                     
    ▸ static/                                                            
    ▸ templates/                                                         
      __init__.py                                                        
      main.py*                                                           
      test.txt                                                           
  ▸ venv/                                                                
    config.py                                                            
    d.py*                                                                
    os                                                                   
    Procfile                                                             
    randomizer.py                                                        
    randomizer.pyc                                                       
    README.md                                                            
    requirements.txt                                                     
    run.py*                                                              
    runtime.txt                                                          
    test.txt                                                             
    word_blocks.py                                                   
    word_blocks.pyc            

感谢。

2 个答案:

答案 0 :(得分:1)

想出来。 Procfile在我的.gitignore中,由我愚蠢地添加。

旁注:应用程序根本不会部署,因为我正在从错误的分支推送。

答案 1 :(得分:0)

我的猜测是你忘了将你的Procfile添加并提交给git。