Heroku Python Webapp - 找不到pip,运行时默认为runtime.txt

时间:2017-08-06 11:49:06

标签: python git heroku web-applications deployment

我是一个新手并且不了解很多概念,所以请原谅我的陈述和问题中有一些含糊不清或明显的谬误。

我正在使用Flask python框架编写一个Web应用程序。我已经在localhost上测试了它。现在我想将它部署到heroku的网络服务器。

以下是存储主文件的文件夹:

static #this is a folder
templates #this is a folder
Procfile
requirements.txt
runtime.txt
app.py

现在分别是Procfile,requirements.txt和runtime.txt的内容:

Procfile:

web: gunicorn app:app

requirements.txt:

 Flask==0.12.2
 gunicorn==19.7.1
 itsdangerous==0.24
 Jinja2==2.9.6
 MarkupSafe==1.0
 Werkzeug==0.12.2

runtime.txt:

 python-2.7.1

现在,在我遇到问题之前,它是python-3.5.1,但是在调试之前我已经把它留给了2.7.1,因为我找到了另一个问题。 / p>

现在当我尝试执行命令时:git push heroku master,生成以​​下ouptut:

Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (13/13), 1.95 KiB | 0 bytes/s, done.
Total 13 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing python-3.5.1
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:     

/app/tmp/buildpacks/{somelonghash}/bin/steps/pip-
install: line 7: /app/.heroku/python/bin/pip: No such file or 
directory

remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to joecrownwebapp.
remote: 
To https://git.heroku.com/joecrownwebapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 
'https://git.heroku.com/joecrownwebapp.git'

{somelonghash} 是一个长哈希,为了这个问题的目的我已经删除了。现在您可以看到首先使用python-3.5.1部署应用程序,这很奇怪,因为我在runtime.txt中指定运行时应该是例如2.7.1。现在我们也看到正在安装pip,然后使用pip安装需求,这就是问题发生的地方。

我想到的第一个问题是:这个" /app/.heroku/python/bin/pip:" 目录究竟在哪里,或者就此而言" / app / tmp / buildpacks / {somelonghash} / bin / steps / pip- 安装"

他们在我的机器上的某个地方吗? (我想不是因为如果它们是基于unix的路径名,那么app应该直接在root下,但是我没有这样的文件夹)

如果他们不在我的机器上,他们在哪里找到它们并检查它们。它们是否位于Heroku服务器上。如果是这样,我的问题出在哪里?为什么我的 runtime.txt 被忽视?

任何想法都将不胜感激!

0 个答案:

没有答案