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

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

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

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

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

3589閲覧

herokuにデプロイできない ENVIRONMENTERROR

yamatar

総合スコア4

Django

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

Anaconda

Anacondaは、Python本体とPythonで利用されるライブラリを一括でインストールできるパッケージです。環境構築が容易になるため、Python開発者間ではよく利用されており、商用目的としても利用できます。

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

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

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2020/11/12 05:10

前提・実現したいこと

python dajngoをherokuにデプロイしたいのですが、
プッシュ中に発生したenvironmenterrorが解決できません。
Procfile,requirements.txt,runtime.txtは作成済みで、manage.pyと
同じフォルダに配置しています。
heroku openでWelcome to your new app!は表示されています。
ご教示お願い致します。

↓herokuデプロイを参考にしたサイト
https://zerofromlight.com/blogs/detail/14/

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

git push heroku main実行内容;

Enumerating objects: 368, done. Counting objects: 100% (368/368), done. Delta compression using up to 4 threads Compressing objects: 100% (296/296), done. Writing objects: 100% (368/368), 1.45 MiB | 49 .65 MiB/s, done. Total 368 (delta 88), reused 327 (delta 63), p ack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: -----> Python app detected remote: ! Python has released a security update! Please consider upgrading to python-3.6.1 2 remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes remote: -----> Installing python-3.6.10 remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2 remote: -----> Installing SQLite3 remote: -----> Installing requirements with pip remote: Processing /home/conda/feedstock_root/build_artifacts/asgiref_1592343924301/work remote: ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/home/conda/feedstock_root/build_artifacts/asgiref_1592343924301/work' remote: remote: ! Push rejected, failed to compile Python app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: 6ad97e5b470ca2125 55ea1e2ce8f882594cc265b remote: ! remote: ! We have detected that you have triggered a build from source code with version 6ad97 e5b470ca212555ea1e2ce8f882594cc265b remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to アプリ名. remote: To https://git.heroku.com/アプリ名.git ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/アプリ名.git'

該当のソースコード

Procfile

1web: gunicorn new_geodj.wsgi --log-file -

requirements.txt

1asgiref @ file:///home/conda/feedstock_root/build_artifacts/asgiref_1592343924301/work 2brotlipy==0.7.0 3certifi==2020.6.20 4cffi==1.14.0 5chardet==3.0.4 6cryptography==2.9.2 7dj-database-url==0.5.0 8Django @ file:///home/conda/feedstock_root/build_artifacts/django_1591280207983/work 9django-cleanup @ file:///home/conda/feedstock_root/build_artifacts/django-cleanup_1600232200403/work 10django-cors-headers==3.2.1 11django-filter @ file:///home/conda/feedstock_root/build_artifacts/django-filter_1591380509061/work 12django-heroku==0.3.1 13django-leaflet==0.25.0 14djangorestframework==3.11.0 15djangorestframework-gis @ file:///home/conda/feedstock_root/build_artifacts/djangorestframework-gis_1591808353793/work 16fastcache==1.1.0 17future==0.18.2 18glob2==0.7 19gunicorn==20.0.4 20idna==2.9 21importlib-metadata @ file:///D:/bld/importlib-metadata_1591451928112/work 22Markdown @ file:///home/conda/feedstock_root/build_artifacts/markdown_1589366472132/work 23mpmath==1.1.0 24olefile==0.46 25Pillow @ file:///D:/bld/pillow_1594212354952/work 26psycopg2==2.8.5 27pycparser==2.20 28pyOpenSSL==19.1.0 29PySocks==1.7.1 30pytz==2020.1 31requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1592425495151/work 32six==1.14.0 33sqlparse==0.3.1 34sympy @ file:///D:/bld/sympy_1597017636149/work 35urllib3==1.25.9 36whitenoise @ file:///home/conda/feedstock_root/build_artifacts/whitenoise_1602596638218/work 37win-inet-pton==1.1.0 38wincertstore==0.2 39zipp==3.1.0

runtime.txt

1python-3.6.10

試したこと

git push heroku main:main,
git push heroku main -force
などを試してみましたが、同じエラーが出ます。

補足情報(FW/ツールのバージョンなど)

windows10
django3.0.7
python3.6.10
anaconda3

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

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

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

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

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

guest

回答1

0

ベストアンサー

読んだ範囲での原因

requirements.tx に列挙されている依存パッケージのいくつかが、単純なバージョンではなくローカル環境下で用意した際のファイルパスベースの指定になっています。

そのため、herokuの環境下に存在しないパスを指定してしまっているため、インストールが出来なくなってます。

対処例

一番無難な方法としては、requirements.txtの中身を「ファイルパス指定のない状態に変える」ことだと思います。

例えば、pip freezeなどを使えば、ファイルパス指定の代わりにバージョン情報を持つrequirements.txtに直すことが出来ます。
そのファイルをコミットすることで、heroku環境上でもインストールが進むのではないでしょうか。

コマンド例 (conda環境だと違ったりするかもしれませんが、そのあたりは個別に確認して下さい)

bash

1$ pip freeze > requirements.txt

ただし、何かしらの理由でそのパッケージをローカルで編集した結果としてファイルパス指定をしていると、その編集が全て欠落する可能性があります。
その場合は、別途何かしらの対応を考える必要があります。

投稿2020/11/12 06:18

attakei

総合スコア2738

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

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

yamatar

2020/11/12 06:46

早速ご回答いただきありがとうございます。 pip freeze > requirements.txtで作った際に、”パスが表示されているのがあるな”とは思っておりました。 パスを削除し、バージョンに書き変えたところ(例:asgiref==3.2.9)、remote: Verifying deploy... done.で完了できました。 早速アプリに飛んでみたんですが”Application error”となっていますが、 このエラーについて解消できない場合は別途質問します。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問