Pipfile.lock关闭

2024-04-26 17:35:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在heroku部署一个大型django项目。我安装了Heroku CLI,登录,创建了一个应用程序并运行:

git push heroku master

我已经设置了Pipfile和requirements.txt。我添加了runtime.txt来指定我需要Python2.7。这也在Pipfile中。这就是我推给heroku的原因:

$ git push heroku master
Counting objects: 12159, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4853/4853), done.
Writing objects: 100% (12159/12159), 20.94 MiB | 1.82 MiB/s, done.
Total 12159 (delta 6859), reused 12036 (delta 6751)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing python-3.6.4
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 11.8.2…
remote:        Your Pipfile.lock (3b2ba9) is out of date. Expected: (83a5b4).
remote:        Aborting deploy.
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy....
remote: 
remote: !   Push rejected to camp-infinity.
remote: 
To https://git.heroku.com/camp-infinity.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/camp-infinity.git'

出于某种原因,它试图安装Python3,而且它也不喜欢我的Pipfile.lock文件。我试过删除它并用pipenv install再次生成它,但这没有改变任何事情。


Tags: togitmasterherokuobjectsremotepushinstalling
3条回答

我删除了Pipfile.lock,并提交了删除操作。Heroku的构建过程抱怨它不在那里,但它确实成功地部署了。。。

-----> Python app detected
 !     No 'Pipfile.lock' found! We recommend you commit this into your repository.
-----> Installing pip
-----> Installing dependencies with Pipenv 11.8.2…
       Installing dependencies from Pipfile…
-----> Discovering process types
       Procfile declares types -> worker
-----> Compressing...
       Done: 189.9M
-----> Launching...
       Released v5

在一个项目中遇到了同样的问题,在你推给Heroku的分支中,运行

pipenv lock

它将更新Pipfile.lock文件。:)

您应该提供:

  1. Pipfile和相应的Pipfile.lock

或者

  1. requirements.txt(和可选的runtime.txt

如果您使用的是Pipfile,那么git rm requirements.txt runtime.txt并确保git add Pipfile Pipfile.lockgit commit然后尝试git push到heroku。

https://devcenter.heroku.com/articles/python-runtimes

相关问题 更多 >