为什么 Heroku 检测不到我的 Procfile?

Why doesn't Heroku detect my Procfile?

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

我正在尝试使用 Heroku 上传一个非常基本的 Flask 应用程序。根据关于 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            

谢谢。

我猜你忘了添加 Procfile 并将其提交到 git。

想通了。 Procfile 在我的 .gitignore 中,是我愚蠢地添加的。

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