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

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

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

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

Heroku

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

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

Python

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

Q&A

解決済

1回答

1379閲覧

Herokuにデプロイはしたが、アプリケーションエラーになる

yayaya22

総合スコア51

Django

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

Heroku

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

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

Python

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

0グッド

0クリップ

投稿2021/02/19 05:53

編集2021/02/28 06:12

前提・実現したいこと

git hubのデータをHerokuにデプロイは完了ですが、開くとアプリケーションエラーが出てグレーの画面になっています。
以下のエラーメッセージが発生しました。

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

ImproperlyConfigured at / You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path. Request Method: GET Request URL: https://*****/ Django Version: 3.1.6 Exception Type: ImproperlyConfigured Exception Value: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path. Exception Location: /app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py, line 38, in path Python Executable: /app/.heroku/python/bin/python Python Version: 3.8.7 Python Path: ['/app/.heroku/python/bin', '/app', '/app/.heroku/python/lib/python38.zip', '/app/.heroku/python/lib/python3.8', '/app/.heroku/python/lib/python3.8/lib-dynload', '/app/.heroku/python/lib/python3.8/site-packages'] Server time: Fri, 19 Feb 2021 17:16:54 +0900 Error during template rendering In template /app/templates/tweet/base.html, error at line 11 You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path. 1 {% load static %} 2 3 <!DOCTYPE html> 4 <html lang="en"> 5 6 <head> 7 <meta charset="UTF-8"> 8 <title>twitter_clone</title> 9 <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"> 10 <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/GrayGrids/LineIcons/LineIcons.css"> 11 <link rel="stylesheet" href="{% static 'css/stylesheets/screen.css' %}"> 12 <link rel="icon" type="image/png" href="{% static 'img/logo.png' %}"> 13 </head> 14 15 <body class="bg-white"> 16 17 <!-- wrapper start --> 18 <div class=""> 19 20 <!-- container start --> 21 <div class="container mx-auto"> Traceback Switch to copy-and-paste view /app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py, line 47, in inner response = get_response(request) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/base.py, line 204, in _get_response response = response.render() … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/response.py, line 105, in render self.content = self.rendered_content … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/response.py, line 83, in rendered_content return template.render(context, self._request) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/backends/django.py, line 61, in render return self.template.render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 170, in render return self._render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 162, in _render return self.nodelist.render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 938, in render bit = node.render_annotated(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 905, in render_annotated return self.render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/loader_tags.py, line 150, in render return compiled_parent._render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 162, in _render return self.nodelist.render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 938, in render bit = node.render_annotated(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/template/base.py, line 905, in render_annotated return self.render(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/templatetags/static.py, line 106, in render url = self.url(context) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/templatetags/static.py, line 103, in url return self.handle_simple(path) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/templatetags/static.py, line 118, in handle_simple return staticfiles_storage.url(path) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/utils/functional.py, line 240, in inner self._setup() … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py, line 438, in _setup self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/whitenoise/storage.py, line 129, in __init__ super().__init__(*args, **kwargs) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py, line 373, in __init__ self.hashed_files = self.load_manifest() … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py, line 383, in load_manifest content = self.read_manifest() … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py, line 377, in read_manifest with self.open(self.manifest_name) as manifest: … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/core/files/storage.py, line 36, in open return self._open(name, mode) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/core/files/storage.py, line 231, in _open return File(open(self.path(name), mode)) … ▶ Local vars /app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py, line 38, in path raise ImproperlyConfigured("You're using the staticfiles app " … ▶ Local vars

試したこと

はじめはcollectstatic関係のエラーが出て
https://devcenter.heroku.com/ja/articles/django-assets
の記事を実行し、環境変数を変えwhitenoiseを入れてエラーは出なくなりました。

追記:
django-crispy-formsをrequirements.txtに追記したらアップはしました。
その後また上記の別エラーです。多分静的ファイル関係かと。。

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

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

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

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

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

guest

回答1

0

自己解決

解決しました。
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')
を挿入したら、ルートディレクトリを読みにいってくれました。

STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] STATIC_ROOT = os.path.join(BASE_DIR, 'static_root') STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

投稿2021/02/19 09:58

yayaya22

総合スコア51

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問