前提・実現したいこと
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に追記したらアップはしました。
その後また上記の別エラーです。多分静的ファイル関係かと。。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。