- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我知道这方面有很多问题,但老实说,大多数问题都没有得到解答,或者解决方案不起作用。
我有“简单”的问题。当我将 Debug 设置为 False 并将其推送到 heroku 时,我收到“服务器错误(500)”。我阅读了这些主题:
Heroku server error (500) when Debug = False , whitenoise could not find style.css
Whenever debug=False in django, Heroku gives Server Error (500) and when debug=True no error
https://www.reddit.com/r/djangolearning/comments/acj65x/why_am_i_getting_a_500_server_error_when/
https://teamtreehouse.com/community/heroku-bad-request-500
我尝试了他们的解决方案,但仍然不起作用。我没有测试并且应该提供帮助的唯一解决方案是摆脱白噪声。这对我来说有点“不去”。
我能怎么办这个错误?
谢谢和干杯!
编辑:
这是我的日志。我试图注释掉白噪声,但没有帮助。
我正在查看我的代码,但我没有任何对“favicon.ico”的引用。此外,我尝试运行 collectstatic ,因为我发现了一些与此相关的主题,但它对我不起作用。
首先它问我:
You have requested to collect static files at the destination
location as specified in your settings:
/app/staticfiles
FileNotFoundError: [Errno 2] No such file or directory: '/app/static'
2020-05-19T05:15:40.192943+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=robotbuilder.herokuapp.com request_id=eeaf4fd1-b73b-4e84-aacd-7e701d3e8932 fwd="83.26.255.146" dyno=web.1 connect=1ms service=3ms status=404 bytes=388 protocol=http
2020-05-19T05:15:39.991705+00:00 app[web.1]: [2020-05-19 05:15:39 +0000] [11] [ERROR] Error handling request /
2020-05-19T05:15:39.991725+00:00 app[web.1]: Traceback (most recent call last):
2020-05-19T05:15:39.991726+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 134, in handle
2020-05-19T05:15:39.991734+00:00 app[web.1]: self.handle_request(listener, req, client, addr)
2020-05-19T05:15:39.991734+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 175, in handle_request
2020-05-19T05:15:39.991735+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response)
2020-05-19T05:15:39.991735+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
2020-05-19T05:15:39.991735+00:00 app[web.1]: response = self.get_response(request)
2020-05-19T05:15:39.991736+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py", line 75, in get_response
2020-05-19T05:15:39.991736+00:00 app[web.1]: response = self._middleware_chain(request)
2020-05-19T05:15:39.991736+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991737+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991739+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991740+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991741+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991741+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991741+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/whitenoise/middleware.py", line 58, in __call__
2020-05-19T05:15:39.991742+00:00 app[web.1]: response = self.get_response(request)
2020-05-19T05:15:39.991746+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991747+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991747+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991747+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991747+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991748+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991748+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991748+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991748+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991749+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991749+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991749+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991750+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991750+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991750+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991750+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991751+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991751+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991751+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991752+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991752+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991752+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991752+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991753+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991753+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991753+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991753+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991754+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991754+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991755+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991763+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991763+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991763+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991764+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991764+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991764+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991765+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991765+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991765+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991765+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991766+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991766+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991766+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991766+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991767+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991767+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991767+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991767+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991768+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991768+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991768+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991769+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991769+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/deprecation.py", line 94, in __call__
2020-05-19T05:15:39.991769+00:00 app[web.1]: response = response or self.get_response(request)
2020-05-19T05:15:39.991769+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991770+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991770+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991770+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991771+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991771+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991771+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/whitenoise/middleware.py", line 58, in __call__
2020-05-19T05:15:39.991771+00:00 app[web.1]: response = self.get_response(request)
2020-05-19T05:15:39.991772+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
2020-05-19T05:15:39.991772+00:00 app[web.1]: response = response_for_exception(request, exc)
2020-05-19T05:15:39.991772+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
2020-05-19T05:15:39.991772+00:00 app[web.1]: response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2020-05-19T05:15:39.991780+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
2020-05-19T05:15:39.991781+00:00 app[web.1]: response = get_response(request)
2020-05-19T05:15:39.991781+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
2020-05-19T05:15:39.991782+00:00 app[web.1]: response = self.process_exception_by_middleware(e, request)
2020-05-19T05:15:39.991782+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
2020-05-19T05:15:39.991782+00:00 app[web.1]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
2020-05-19T05:15:39.991783+00:00 app[web.1]: File "/app/builder/views.py", line 8, in home
2020-05-19T05:15:39.991783+00:00 app[web.1]: return render(request, "builder/home.html")
2020-05-19T05:15:39.991783+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/shortcuts.py", line 19, in render
2020-05-19T05:15:39.991784+00:00 app[web.1]: content = loader.render_to_string(template_name, context, request, using=using)
2020-05-19T05:15:39.991790+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/loader.py", line 62, in render_to_string
2020-05-19T05:15:39.991790+00:00 app[web.1]: return template.render(context, request)
2020-05-19T05:15:39.991791+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
2020-05-19T05:15:39.991791+00:00 app[web.1]: return self.template.render(context)
2020-05-19T05:15:39.991791+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 171, in render
2020-05-19T05:15:39.991792+00:00 app[web.1]: return self._render(context)
2020-05-19T05:15:39.991792+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
2020-05-19T05:15:39.991792+00:00 app[web.1]: return self.nodelist.render(context)
2020-05-19T05:15:39.991792+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 936, in render
2020-05-19T05:15:39.991793+00:00 app[web.1]: bit = node.render_annotated(context)
2020-05-19T05:15:39.991793+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 903, in render_annotated
2020-05-19T05:15:39.991798+00:00 app[web.1]: return self.render(context)
2020-05-19T05:15:39.991798+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
2020-05-19T05:15:39.991798+00:00 app[web.1]: return compiled_parent._render(context)
2020-05-19T05:15:39.991799+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
2020-05-19T05:15:39.991799+00:00 app[web.1]: return self.nodelist.render(context)
2020-05-19T05:15:39.991799+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 936, in render
2020-05-19T05:15:39.991799+00:00 app[web.1]: bit = node.render_annotated(context)
2020-05-19T05:15:39.991800+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py", line 903, in render_annotated
2020-05-19T05:15:39.991800+00:00 app[web.1]: return self.render(context)
2020-05-19T05:15:39.991800+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/templatetags/static.py", line 106, in render
2020-05-19T05:15:39.991800+00:00 app[web.1]: url = self.url(context)
2020-05-19T05:15:39.991804+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/templatetags/static.py", line 103, in url
2020-05-19T05:15:39.991804+00:00 app[web.1]: return self.handle_simple(path)
2020-05-19T05:15:39.991804+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/templatetags/static.py", line 118, in handle_simple
2020-05-19T05:15:39.991805+00:00 app[web.1]: return staticfiles_storage.url(path)
2020-05-19T05:15:39.991805+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 153, in url
2020-05-19T05:15:39.991805+00:00 app[web.1]: return self._url(self.stored_name, name, force)
2020-05-19T05:15:39.991806+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 132, in _url
2020-05-19T05:15:39.991806+00:00 app[web.1]: hashed_name = hashed_name_func(*args)
2020-05-19T05:15:39.991806+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 423, in stored_name
2020-05-19T05:15:39.991806+00:00 app[web.1]: raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
2020-05-19T05:15:39.991807+00:00 app[web.1]: ValueError: Missing staticfiles manifest entry for 'builder/logo.png'
2020-05-19T05:15:39.992027+00:00 app[web.1]: 10.95.191.28 - - [19/May/2020:05:15:39 +0000] "GET / HTTP/1.1" 500 0 "-" "-"
2020-05-19T05:15:40.192825+00:00 app[web.1]: 10.95.191.28 - - [19/May/2020:05:15:40 +0000] "GET /favicon.ico HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0"
2020-05-19T05:15:39.996509+00:00 heroku[router]: at=info method=GET path="/" host=robotbuilder.herokuapp.com request_id=de877e93-558a-40ab-bf11-b6de261cb707 fwd="83.26.255.146" dyno=web.1 connect=1ms service=57ms status=500 bytes=244 protocol=http
import os
import django_heroku
from decouple import config
import dj_database_url
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'builder',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'robot_builder.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'robot_builder.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
}
}
# If you want to work with your remote database on your local machine, you need to paste link from heroku lower:
# DATABASES['default'] = dj_database_url.config(default='postgres://qkwlkrkahynyik:21a1420ab5820795f3a0c736ebb607419fc7a111f093924dcfc4567dfd906b9f@ec2-54-147-209-121.compute-1.amazonaws.com:5432/d2v01dp40p4er2')
db_from_env = dj_database_url.config(conn_max_age=600)
DATABASES['default'].update(db_from_env)
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_TMP = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Debugging in heroku live
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(asctime)s [%(process)d] [%(levelname)s] ' +
'pathname=%(pathname)s lineno=%(lineno)s ' +
'funcname=%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S'
},
'simple': {
'format': '%(levelname)s %(message)s'
}
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'testlogger': {
'handlers': ['console'],
'level': 'INFO',
}
}
}
DEBUG_PROPAGATE_EXCEPTIONS = True
COMPRESS_ENABLED = os.environ.get('COMPRESS_ENABLED', False)
# Activate Django-Heroku.
django_heroku.settings(locals())
robot_builder
> builder
>> migrations
>> static
>>> css
>>> builder
>>>> my images, including logo.png used as favicon
>> templates
>> models.py etc.
> media
> robot_builder
>> settings.py etc.
> staticfiles
最佳答案
通过键入以下内容,heroku logs --tail -a your_herokuapp_name
来通过日志调试您的 django 应用程序或 https://dashboard.heroku.com/apps/your_herokuapp_name/logs .
在此之前,将此添加到您的 settings.py
中:
# Debugging in heroku live
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(asctime)s [%(process)d] [%(levelname)s] ' +
'pathname=%(pathname)s lineno=%(lineno)s ' +
'funcname=%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S'
},
'simple': {
'format': '%(levelname)s %(message)s'
}
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'testlogger': {
'handlers': ['console'],
'level': 'INFO',
}
}
}
DEBUG_PROPAGATE_EXCEPTIONS = True
COMPRESS_ENABLED = os.environ.get('COMPRESS_ENABLED', False)
debug=False
的错误在 heroku 日志中。
关于Django Heroku Server Error (500) 当我设置 Debug - False on True 时它工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61854083/
reqwest v0.9 将 serde v1.0 作为依赖项,因此实现 converting serde_json errors into reqwest error . 在我的代码中,我使用 se
我有这个代码: let file = FileStorage { // ... }; file.write("Test", bytes.as_ref()) .map_err(|e| Mu
我只是尝试用angular-cli创建一个新项目,然后运行服务器,但是它停止并显示一条有趣的消息:Error: No errors。 我以这种方式更新了(希望有帮助):npm uninstall -g
我从我的 javascript 发送交易 Metamask 打开传输对话框 我确定 i get an error message in metamask (inpage.js:1 MetaMask -
这个问题在这里已经有了答案: How do you define custom `Error` types in Rust? (3 个答案) How to get a reference to a
我想知道两者之间有什么大的区别 if let error = error{} vs if error != nil?或者只是人们的不同之处,比如他们如何用代码表达自己? 例如,如果我使用这段代码: u
当我尝试发送超过 50KB 的图像时,我在 Blazor 服务器应用程序上收到以下错误消息 Error: Connection disconnected with error 'Error: Serv
我有一个error-page指令,它将所有异常重定向到错误显示页面 我的web.xml: [...] java.lang.Exception /vi
我有这样的对象: address: { "phone" : 888, "value" : 12 } 在 WHERE 中我需要通过 address.value 查找对象,但是在 SQL 中有函数
每次我尝试编译我的代码时,我都会遇到大量错误。这不是我的代码的问题,因为它在另一台计算机上工作得很好。我尝试重新安装和修复,但这没有帮助。这是整个错误消息: 1>------ Build starte
在我的代码的类部分,如果我写一个错误,则在不应该的情况下,将有几行报告为错误。我将'| error'放在可以从错误中恢复的良好/安全位置,但是我认为它没有使用它。也许它试图在某个地方恢复中间表情? 有
我遇到了 csv 输入文件整体读取故障的问题,我可以通过在 read_csv 函数中添加 "error_bad_lines=False" 来删除这些问题来解决这个问题。 但是我需要报告这些造成问题的文
在 Spring 中,验证后我们在 controller 中得到一个 BindingResult 对象。 很简单,如果我收到验证错误,我想重新显示我的表单,并在每个受影响的字段上方显示错误消息。 因此
我不知道出了什么问题,因为我用 Java 编程了大约一年,从来没有遇到过这个错误。在一分钟前在 Eclipse 中编译和运行工作,现在我得到这个错误: #A fatal error has been
SELECT to_char(messages. TIME, 'YYYY/MM/DD') AS FullDate, to_char(messages. TIME, 'MM/DD
我收到这些错误: AnonymousPath\Anonymized.vb : error BC30037: Character is not valid. AnonymousPath\Anonymiz
我刚刚安装了 gridengine 并在执行 qstat 时出现错误: error: commlib error: got select error (Connection refused) erro
嗨,我正在学习 PHP,我从 CRUD 系统开始,我在 Windows 上安装了 WAMP 服务器,当我运行它时,我收到以下错误消息。 SCREAM: Error suppression ignore
我刚刚开始一个新项目,我正在学习核心数据教程,可以找到:https://www.youtube.com/watch?v=zZJpsszfTHM 我似乎无法弄清楚为什么会抛出此错误。我有一个名为“Exp
当我使用 Jenkins 运行新构建时,出现以下错误: "FilePathY\XXX.cpp : fatal error C1853: 'FilePathZ\XXX.pch' precompiled
我是一名优秀的程序员,十分优秀!