'NoneType' object has no attribute 'width'
Request Method: | GET |
---|---|
Request URL: | http://localhost/de/tools-of-the-trade-douglas-c-47d-skytrain/ |
Django Version: | 4.1.7 |
Exception Type: | AttributeError |
Exception Value: | 'NoneType' object has no attribute 'width' |
Exception Location: | /var/www/berlin_airlift/timeline/models.py, line 72, in get_context |
Raised during: | wagtail.views.serve |
Python Executable: | /usr/home/filip/.cache/pypoetry/virtualenvs/berlin-airlift-lL7Z2-sV-py3.9/bin/python |
Python Version: | 3.9.16 |
Python Path: | ['/var/www/berlin_airlift', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/usr/home/filip/.cache/pypoetry/virtualenvs/berlin-airlift-lL7Z2-sV-py3.9/lib/python3.9/site-packages', '/var/www/berlin_airlift'] |
Server time: | Sun, 22 Dec 2024 06:00:51 +0000 |
/usr/home/filip/.cache/pypoetry/virtualenvs/berlin-airlift-lL7Z2-sV-py3.9/lib/python3.9/site-packages/django/core/handlers/exception.py
, line 56, in inner
return inner
else:
@wraps(get_response)
def inner(request):
try:
response = get_response(request)…
except Exception as exc:
response = response_for_exception(request, exc)
return response
return inner
Variable | Value |
---|---|
exc | AttributeError("'NoneType' object has no attribute 'width'") |
get_response | <bound method BaseHandler._get_response of <django.core.handlers.base.BaseHandler object at 0x896b26e80>> |
request | <WSGIRequest: GET '/de/tools-of-the-trade-douglas-c-47d-skytrain/'> |
/usr/home/filip/.cache/pypoetry/virtualenvs/berlin-airlift-lL7Z2-sV-py3.9/lib/python3.9/site-packages/django/core/handlers/base.py
, line 197, in _get_response
if response is None:
wrapped_callback = self.make_view_atomic(callback)
# If it is an asynchronous view, run it in a subthread.
if asyncio.iscoroutinefunction(wrapped_callback):
wrapped_callback = async_to_sync(wrapped_callback)
try:
response = wrapped_callback(request, *callback_args, **callback_kwargs)…
except Exception as e:
response = self.process_exception_by_middleware(e, request)
if response is None:
raise
# Complain if the view returned None (a common error).
Variable | Value |
---|---|
callback | <function serve at 0x8b0eebf70> |
callback_args | ('tools-of-the-trade-douglas-c-47d-skytrain/',) |
callback_kwargs | {} |
middleware_method | <bound method CsrfViewMiddleware.process_view of <CsrfViewMiddleware get_response=convert_exception_to_response.<locals>.inner>> |
request | <WSGIRequest: GET '/de/tools-of-the-trade-douglas-c-47d-skytrain/'> |
response | None |
self | <django.core.handlers.base.BaseHandler object at 0x896b26e80> |
wrapped_callback | <function serve at 0x8b0eebf70> |
/usr/home/filip/.cache/pypoetry/virtualenvs/berlin-airlift-lL7Z2-sV-py3.9/lib/python3.9/site-packages/wagtail/views.py
, line 28, in serve
)
for fn in hooks.get_hooks("before_serve_page"):
result = fn(page, request, args, kwargs)
if isinstance(result, HttpResponse):
return result
return page.serve(request, *args, **kwargs)…
def authenticate_with_password(request, page_view_restriction_id, page_id):
"""
Handle a submission of PasswordViewRestrictionForm to grant view access over a
subtree that is protected by a PageViewRestriction
Variable | Value |
---|---|
args | [] |
fn | <function check_view_restrictions at 0x8aaa17e50> |
kwargs | {} |
page | <TimelinePost: Handwerkszeug: Douglas C-47 Skytrain> |
path | 'tools-of-the-trade-douglas-c-47d-skytrain/' |
path_components | ['tools-of-the-trade-douglas-c-47d-skytrain'] |
request | <WSGIRequest: GET '/de/tools-of-the-trade-douglas-c-47d-skytrain/'> |
result | None |
site | <Site: localhost [Standard]> |
/usr/home/filip/.cache/pypoetry/virtualenvs/berlin-airlift-lL7Z2-sV-py3.9/lib/python3.9/site-packages/wagtail/models/__init__.py
, line 1998, in serve
def serve(self, request, *args, **kwargs):
request.is_preview = False
return TemplateResponse(
request,
self.get_template(request, *args, **kwargs),
self.get_context(request, *args, **kwargs),…
)
def is_navigable(self):
"""
Return true if it's meaningful to browse subpages of this page -
i.e. it currently has subpages,
Variable | Value |
---|---|
args | () |
kwargs | {} |
request | <WSGIRequest: GET '/de/tools-of-the-trade-douglas-c-47d-skytrain/'> |
self | <TimelinePost: Handwerkszeug: Douglas C-47 Skytrain> |
/var/www/berlin_airlift/timeline/models.py
, line 72, in get_context
image = self.related_images.first()
first_image_orientation = None
if image:
width = image.post_image.width…
height = image.post_image.height
if width > height:
first_image_orientation = "landscape"
if width < height:
first_image_orientation = "portrait"
Variable | Value |
---|---|
__class__ | <class 'timeline.models.TimelinePost'> |
context | {'page': <TimelinePost: Handwerkszeug: Douglas C-47 Skytrain>, 'request': <WSGIRequest: GET '/de/tools-of-the-trade-douglas-c-47d-skytrain/'>, 'self': <TimelinePost: Handwerkszeug: Douglas C-47 Skytrain>} |
first_image_orientation | None |
image | <RelatedImages: RelatedImages object (48)> |
request | <WSGIRequest: GET '/de/tools-of-the-trade-douglas-c-47d-skytrain/'> |
self | <TimelinePost: Handwerkszeug: Douglas C-47 Skytrain> |
AnonymousUser
No GET data
No POST data
No FILES data
No cookie data
Variable | Value |
---|---|
HTTP_COOKIE | '' |
PATH_INFO | '/de/tools-of-the-trade-douglas-c-47d-skytrain/' |
QUERY_STRING | '' |
REMOTE_ADDR | '127.0.0.1' |
REQUEST_METHOD | 'GET' |
SCRIPT_NAME | '' |
SERVER_NAME | 'localhost' |
SERVER_PORT | '80' |
SERVER_PROTOCOL | 'HTTP/1.1' |
wsgi.errors | <_io.BytesIO object at 0x8c04d64a0> |
wsgi.input | <django.test.client.FakePayload object at 0x8be6c3a00> |
wsgi.multiprocess | True |
wsgi.multithread | False |
wsgi.run_once | False |
wsgi.url_scheme | 'http' |
wsgi.version | (1, 0) |
berlin_airlift.settings.dev
Setting | Value |
---|---|
ABSOLUTE_URL_OVERRIDES | {} |
ADMINS | [] |
ALLOWED_HOSTS | ['*'] |
APPEND_SLASH | True |
AUTHENTICATION_BACKENDS | ['django.contrib.auth.backends.ModelBackend'] |
AUTH_PASSWORD_VALIDATORS | '********************' |
AUTH_USER_MODEL | 'auth.User' |
BAKERY_MULTISITE | True |
BAKERY_VIEWS | ('wagtailbakery.views.AllPublishedPagesView',) |
BASE_DIR | '/var/www/berlin_airlift' |
BUILD_DIR | '/var/www/berlin_airlift/static-site' |
CACHES | {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} |
CACHE_MIDDLEWARE_ALIAS | 'default' |
CACHE_MIDDLEWARE_KEY_PREFIX | '********************' |
CACHE_MIDDLEWARE_SECONDS | 600 |
CSRF_COOKIE_AGE | 31449600 |
CSRF_COOKIE_DOMAIN | None |
CSRF_COOKIE_HTTPONLY | False |
CSRF_COOKIE_MASKED | False |
CSRF_COOKIE_NAME | 'csrftoken' |
CSRF_COOKIE_PATH | '/' |
CSRF_COOKIE_SAMESITE | 'Lax' |
CSRF_COOKIE_SECURE | False |
CSRF_FAILURE_VIEW | 'django.views.csrf.csrf_failure' |
CSRF_HEADER_NAME | 'HTTP_X_CSRFTOKEN' |
CSRF_TRUSTED_ORIGINS | [] |
CSRF_USE_SESSIONS | False |
DATABASES | {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_HEALTH_CHECKS': False, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': '/var/www/berlin_airlift/db.sqlite3', 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}} |
DATABASE_ROUTERS | [] |
DATA_UPLOAD_MAX_MEMORY_SIZE | 2621440 |
DATA_UPLOAD_MAX_NUMBER_FIELDS | 1000 |
DATA_UPLOAD_MAX_NUMBER_FILES | 100 |
DATETIME_FORMAT | 'N j, Y, P' |
DATETIME_INPUT_FORMATS | ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M'] |
DATE_FORMAT | 'N j, Y' |
DATE_INPUT_FORMATS | ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y'] |
DEBUG | True |
DEBUG_PROPAGATE_EXCEPTIONS | False |
DECIMAL_SEPARATOR | '.' |
DEFAULT_AUTO_FIELD | 'django.db.models.AutoField' |
DEFAULT_CHARSET | 'utf-8' |
DEFAULT_EXCEPTION_REPORTER | 'django.views.debug.ExceptionReporter' |
DEFAULT_EXCEPTION_REPORTER_FILTER | 'django.views.debug.SafeExceptionReporterFilter' |
DEFAULT_FILE_STORAGE | 'django.core.files.storage.FileSystemStorage' |
DEFAULT_FROM_EMAIL | 'webmaster@localhost' |
DEFAULT_INDEX_TABLESPACE | '' |
DEFAULT_TABLESPACE | '' |
DISALLOWED_USER_AGENTS | [] |
EMAIL_BACKEND | 'django.core.mail.backends.console.EmailBackend' |
EMAIL_HOST | 'localhost' |
EMAIL_HOST_PASSWORD | '********************' |
EMAIL_HOST_USER | '' |
EMAIL_PORT | 25 |
EMAIL_SSL_CERTFILE | None |
EMAIL_SSL_KEYFILE | '********************' |
EMAIL_SUBJECT_PREFIX | '[Django] ' |
EMAIL_TIMEOUT | None |
EMAIL_USE_LOCALTIME | False |
EMAIL_USE_SSL | False |
EMAIL_USE_TLS | False |
FILE_UPLOAD_DIRECTORY_PERMISSIONS | None |
FILE_UPLOAD_HANDLERS | ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler'] |
FILE_UPLOAD_MAX_MEMORY_SIZE | 2621440 |
FILE_UPLOAD_PERMISSIONS | 420 |
FILE_UPLOAD_TEMP_DIR | None |
FIRST_DAY_OF_WEEK | 0 |
FIXTURE_DIRS | [] |
FORCE_SCRIPT_NAME | None |
FORMAT_MODULE_PATH | None |
FORM_RENDERER | 'django.forms.renderers.DjangoTemplates' |
IGNORABLE_404_URLS | [] |
INSTALLED_APPS | ['home', 'standardpage', 'timeline', 'chapter', 'bakery', 'wagtailbakery', 'debug_toolbar', 'wagtailmedia', 'wagtail.contrib.forms', 'wagtail.contrib.redirects', 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', 'wagtail.snippets', 'wagtail.documents', 'wagtail.images', 'wagtail.search', 'wagtail.admin', 'wagtail_localize', 'wagtail_localize.locales', 'wagtail', 'modelcluster', 'taggit', 'wagtail.contrib.settings', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] |
INTERNAL_IPS | [] |
LANGUAGES | [('en', 'English'), ('de', 'German')] |
LANGUAGES_BIDI | ['he', 'ar', 'ar-dz', 'fa', 'ur'] |
LANGUAGE_CODE | 'en' |
LANGUAGE_COOKIE_AGE | None |
LANGUAGE_COOKIE_DOMAIN | None |
LANGUAGE_COOKIE_HTTPONLY | False |
LANGUAGE_COOKIE_NAME | 'django_language' |
LANGUAGE_COOKIE_PATH | '/' |
LANGUAGE_COOKIE_SAMESITE | None |
LANGUAGE_COOKIE_SECURE | False |
LOCALE_PATHS | ['/var/www/berlin_airlift/locale'] |
LOGGING | {} |
LOGGING_CONFIG | 'logging.config.dictConfig' |
LOGIN_REDIRECT_URL | '/accounts/profile/' |
LOGIN_URL | '/accounts/login/' |
LOGOUT_REDIRECT_URL | None |
MANAGERS | [] |
MEDIA_ROOT | '/var/www/berlin_airlift/media' |
MEDIA_URL | '/media/' |
MESSAGE_STORAGE | 'django.contrib.messages.storage.fallback.FallbackStorage' |
MIDDLEWARE | ['debug_toolbar.middleware.DebugToolbarMiddleware', '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', 'django.middleware.security.SecurityMiddleware', 'wagtail.contrib.redirects.middleware.RedirectMiddleware', 'django.middleware.locale.LocaleMiddleware'] |
MIGRATION_MODULES | {} |
MONTH_DAY_FORMAT | 'F j' |
NUMBER_GROUPING | 0 |
PASSWORD_HASHERS | '********************' |
PASSWORD_RESET_TIMEOUT | '********************' |
PREPEND_WWW | False |
PROJECT_DIR | '/var/www/berlin_airlift/berlin_airlift' |
ROOT_URLCONF | 'berlin_airlift.urls' |
SECRET_KEY | '********************' |
SECRET_KEY_FALLBACKS | '********************' |
SECURE_CONTENT_TYPE_NOSNIFF | True |
SECURE_CROSS_ORIGIN_OPENER_POLICY | 'same-origin' |
SECURE_HSTS_INCLUDE_SUBDOMAINS | False |
SECURE_HSTS_PRELOAD | False |
SECURE_HSTS_SECONDS | 0 |
SECURE_PROXY_SSL_HEADER | None |
SECURE_REDIRECT_EXEMPT | [] |
SECURE_REFERRER_POLICY | 'same-origin' |
SECURE_SSL_HOST | None |
SECURE_SSL_REDIRECT | False |
SERVER_EMAIL | 'root@localhost' |
SESSION_CACHE_ALIAS | 'default' |
SESSION_COOKIE_AGE | 1209600 |
SESSION_COOKIE_DOMAIN | None |
SESSION_COOKIE_HTTPONLY | True |
SESSION_COOKIE_NAME | 'sessionid' |
SESSION_COOKIE_PATH | '/' |
SESSION_COOKIE_SAMESITE | 'Lax' |
SESSION_COOKIE_SECURE | False |
SESSION_ENGINE | 'django.contrib.sessions.backends.db' |
SESSION_EXPIRE_AT_BROWSER_CLOSE | False |
SESSION_FILE_PATH | None |
SESSION_SAVE_EVERY_REQUEST | False |
SESSION_SERIALIZER | 'django.contrib.sessions.serializers.JSONSerializer' |
SETTINGS_MODULE | 'berlin_airlift.settings.dev' |
SHORT_DATETIME_FORMAT | 'm/d/Y P' |
SHORT_DATE_FORMAT | 'm/d/Y' |
SIGNING_BACKEND | 'django.core.signing.TimestampSigner' |
SILENCED_SYSTEM_CHECKS | [] |
SITE_ROOT | '/var/www/berlin_airlift' |
STATICFILES_DIRS | ['/var/www/berlin_airlift/berlin_airlift/static'] |
STATICFILES_FINDERS | ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder'] |
STATICFILES_STORAGE | 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' |
STATIC_ROOT | '/var/www/berlin_airlift/static' |
STATIC_URL | '/static/' |
TEMPLATES | [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/var/www/berlin_airlift/berlin_airlift/templates'], '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']}}] |
TEST_NON_SERIALIZED_APPS | [] |
TEST_RUNNER | 'django.test.runner.DiscoverRunner' |
THOUSAND_SEPARATOR | ',' |
TIME_FORMAT | 'P' |
TIME_INPUT_FORMATS | ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M'] |
TIME_ZONE | 'UTC' |
USE_DEPRECATED_PYTZ | False |
USE_I18N | True |
USE_L10N | True |
USE_THOUSAND_SEPARATOR | False |
USE_TZ | True |
USE_X_FORWARDED_HOST | False |
USE_X_FORWARDED_PORT | False |
WAGTAILADMIN_BASE_URL | 'http://example.com' |
WAGTAILIMAGES_MAX_UPLOAD_SIZE | 167772160 |
WAGTAILMEDIA | {'AUDIO_EXTENSIONS': [], 'MEDIA_FORM_BASE': '', 'MEDIA_MODEL': 'wagtailmedia.Media', 'VIDEO_EXTENSIONS': []} |
WAGTAILSEARCH_BACKENDS | {'default': {'BACKEND': 'wagtail.search.backends.database'}} |
WAGTAILSIMPLETRANSLATION_SYNC_PAGE_TREE | True |
WAGTAIL_CONTENT_LANGUAGES | [('en', 'English'), ('de', 'German')] |
WAGTAIL_I18N_ENABLED | True |
WAGTAIL_SITE_NAME | 'berlin_airlift' |
WSGI_APPLICATION | 'berlin_airlift.wsgi.application' |
X_FRAME_OPTIONS | 'DENY' |
YEAR_MONTH_FORMAT | 'F Y' |
You’re seeing this error because you have DEBUG = True
in your
Django settings file. Change that to False
, and Django will
display a standard page generated by the handler for this status code.