本文介绍了Pipfile.lock过时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我已经设置了Pipfile和requirements.txt。我添加了一个runtime.txt来指定我需要python 2.7。这也在Pipfile中。这是我从推送到heroku得到的:

  $ git push heroku master 
计数对象:12159,完成。
使用多达2个线程的增量压缩。
压缩对象:100%(4853/4853),完成。
写作对象:100%(12159/12159),20.94 MiB | 1.82 MiB / s,完成。
合计12159(delta 6859),重复使用12036(delta 6751)
remote:压缩源文件...完成。
remote:建筑来源:
remote:
remote:-----> Python应用程序检测到
remote:----->安装python-3.6.4
remote:----->安装pip
remote:----->使用Pipenv安装依赖关系11.8.2 ...
remote:您的Pipfile.lock(3b2ba9)已过期。预计:(83a5b4)。
remote:中止部署。
remote:!推送被拒绝,未能编译Python应用程序。
remote:
remote:!推送失败
remote:验证部署....
remote:
remote:!推送拒绝营地无限。
remote:
至https://git.heroku.com/camp-infinity.git
! [remote rejected] master - > master(pre-receive hook refused)
错误:未能将一些文件推送到'https://git.heroku.com/camp-infinity.git'

由于某些原因,它试图安装python 3,而且它也不喜欢我的Pipfile.lock文件。我已经尝试删除它并使用pipenv安装再次生成它,但这并没有改变任何东西。

解决方案

遇到同样的问题当您在一个项目中工作时,在您推向Heroku的分支中,运行

  pipenv lock 

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

I'm trying to deploy a large django project to heroku. I installed Heroku CLI, logged in, created an app and ran:

git push heroku master

I have a Pipfile and requirements.txt already set up. I added a runtime.txt to specify that I need python 2.7. This is also in the Pipfile. This is what I get from pushing to 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'

For some reason it tries to install python 3, and it also doesn't like my Pipfile.lock file. I've tried deleting it and generating it again with pipenv install but that didn't change anything.

解决方案

Experienced the same problem while working on a project, in the branch you are pushing to Heroku, run

pipenv lock

and it will update the Pipfile.lock file. :)

这篇关于Pipfile.lock过时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 14:39