Ответ 1
Опытная та же проблема во время работы над проектом, в ветке, которую вы нажимаете на Heroku, запустите
pipenv lock
и он обновит файл Pipfile.lock.:)
Я пытаюсь развернуть большой проект django для heroku. Я установил CLI Heroku, вошел в систему, создал приложение и запустил:
git push heroku master
У меня уже установлен файл Pipfile и requirements.txt. Я добавил файл runtime.txt, чтобы указать, что мне нужен python 2.7. Это также в Pipfile. Это то, что я получаю от нажатия на герою:
$ 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'
По какой-то причине он пытается установить python 3, а также не нравится файл Pipfile.lock. Я попытался удалить его и снова создать с помощью pipenv install, но ничего не изменил.
Опытная та же проблема во время работы над проектом, в ветке, которую вы нажимаете на Heroku, запустите
pipenv lock
и он обновит файл Pipfile.lock.:)
Я удалил Pipfile.lock
и 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
Вы должны указать либо:
Pipfile
и соответствующий Pipfile.lock
или
requirements.txt
(и необязательно runtime.txt
)Если вы используете Pipfile
, затем git rm requirements.txt runtime.txt
и убедитесь, что git add Pipfile Pipfile.lock
. git commit
, а затем попробуйте использовать git push
для герою.
У меня была такая же проблема, и это было из-за символической ссылки, указывающей на Pipfile.lock.
После клонирования репозитория в моей локальной среде Mac OS, по некоторым причинам, исходная ссылка была как-то неработающей, в результате чего Your Pipfile.lock(3b2ba9) is out of date. Expected: (83a5b4)
Your Pipfile.lock(3b2ba9) is out of date. Expected: (83a5b4)
при толчке к Heroku.
Просто удалив "старую" символическую ссылку и воссоздав ее из моего локального окружения, решил проблему.
Используя Heroku CLI, я запускал git push heroku master
из локальной ветки, которая не была master
, когда появилась эта точная ошибка:
remote: -----> Python app detected
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Your Pipfile.lock (38bf21) is out of date. Expected: (e4987e).
remote: Aborting deploy.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
Развертывание из master
ветки исправило это.
Если вы хотите git push heroku branchname:master
Heroku, который не является master
, запустите git push heroku branchname:master
.
Обновление моего pipenv: pip install pipenv --upgrade
затем выполните: pipenv lock
выполните коммит
исправил это для меня
Еще один совет: обязательно сделайте git add.
и git commit -m "whatever"
если вы Pipfile.lock
свой Pipfile.lock
и не видите никаких изменений. :)