質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

0回答

187閲覧

Django を Heroku でデプロイしたい。Pythonのバージョンが変わらない。

shoo.

総合スコア2

Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2022/06/21 16:20

前提・実現したいこと

Django を Heroku でデプロイしたい。

使っているツールのバージョンなど補足情報

Windows10
Python 3.8.5
Django 4.0.5
django-heroku 0.3.1

発生している問題・エラーメッセージ

Ubuntu

1××××@DESKTOP-1MQ5361:/mnt/c/Users/××××/Desktop/myproject$ git push heroku master 2Enumerating objects: 46, done. 3Counting objects: 100% (46/46), done. 4Delta compression using up to 4 threads 5Compressing objects: 100% (43/43), done. 6Writing objects: 100% (46/46), 24.23 KiB | 50.00 KiB/s, done. 7Total 46 (delta 2), reused 0 (delta 0) 8remote: Compressing source files... done. 9remote: Building source: 10remote: 11remote: -----> Building on the Heroku-20 stack 12remote: -----> Determining which buildpack to use for this app 13remote: -----> Python app detected 14remote: -----> No Python version was specified. Using the buildpack default: python-3.10.5 15remote: To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes 16remote: -----> Installing python-3.10.5 17remote: -----> Installing pip 22.1.2, setuptools 60.10.0 and wheel 0.37.1 18remote: -----> Installing SQLite3 19remote: -----> Installing requirements with pip 20remote: Processing /C:/ci/argon2-cffi_1596828585465/work 21remote: ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/C:/ci/argon2-cffi_1596828585465/work' 22remote: 23remote: ! Push rejected, failed to compile Python app. 24remote: 25remote: ! Push failed 26remote: ! 27remote: ! ## Warning - The same version of this code has already been built: ab8dedeae8cbff64cbe2cdc36877d6b14809f06e 28remote: ! 29remote: ! We have detected that you have triggered a build from source code with version ab8dedeae8cbff64cbe2cdc36877d6b14809f06e 30remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. 31remote: ! 32remote: ! If you are developing on a branch and deploying via git you must run: 33remote: ! 34remote: ! git push heroku <branchname>:main 35remote: ! 36remote: ! This article goes into details on the behavior: 37remote: ! https://devcenter.heroku.com/articles/duplicate-build-version 38remote: 39remote: Verifying deploy... 40remote: 41remote: ! Push rejected to ×××××××××××××. 42remote: 43To https://git.heroku.com/×××××××××××××.git 44 ! [remote rejected] master -> master (pre-receive hook declined) 45error: failed to push some refs to 'https://git.heroku.com/×××××××××××××.git'

自分で調べたことや試したこと

【Django】Herokuへデプロイしアプリを公開 の通りに試してみました。
runtime.txtファイルを作成の際に、 Python のバージョンが 3.8.5 であり、 HerokuのRuntimeのサポート の対象外であることが判明したため、 Python3.10.5 をインストールしました。その後に下記のコマンドを実行しました。

command

1C:\Users\×××>python -V 2Python 3.8.5 3 4C:\Users\×××>where python 5C:\Users\×××\anaconda3\python.exe 6C:\Users\×××\AppData\Local\Programs\Python\Python310\python.exe 7C:\Users\×××\AppData\Local\Microsoft\WindowsApps\python.exe

結果、 $ python -V コマンドでのバージョンは変わっていませんでした。
$ where python では2行目に Python 3.10.5 のパスがあることが確認できます。
この状態で再度 $ git push heroku master しても同じエラーメッセージが表示されました。

Python のバージョンが Heroku に対応していないのがエラーの要因でしょうか?
どうやったら改善できるでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問