list index out of range
Request Method: | GET |
---|---|
Request URL: | http://minhasplantas.com.br/plantas/categorias/gramas/ |
Django Version: | 5.0.2 |
Exception Type: | IndexError |
Exception Value: | list index out of range |
Exception Location: | /home/ubuntu/.env/2023/lib/python3.10/site-packages/django/db/models/query.py, line 434, in __getitem__ |
Raised during: | plantas.views.index |
Python Executable: | /home/ubuntu/.env/2023/bin/python3 |
Python Version: | 3.10.12 |
Python Path: | ['/home/ubuntu/minhasplantas', '/home/ubuntu/.env/2023/bin', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/ubuntu/.env/2023/lib/python3.10/site-packages'] |
Server time: | Thu, 28 Mar 2024 16:38:17 -0300 |
/home/ubuntu/.env/2023/lib/python3.10/site-packages/django/core/handlers/exception.py
, line 55, 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 | IndexError('list index out of range') |
get_response | <bound method BaseHandler._get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x7f9aeb753520>> |
request | <WSGIRequest: GET '/plantas/categorias/gramas/'> |
/home/ubuntu/.env/2023/lib/python3.10/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 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 index at 0x7f9aeb3644c0> |
callback_args | () |
callback_kwargs | {'cat': 'gramas'} |
middleware_method | <bound method CsrfViewMiddleware.process_view of <CsrfViewMiddleware get_response=convert_exception_to_response.<locals>.inner>> |
request | <WSGIRequest: GET '/plantas/categorias/gramas/'> |
response | None |
self | <django.core.handlers.wsgi.WSGIHandler object at 0x7f9aeb753520> |
wrapped_callback | <function index at 0x7f9aeb3644c0> |
/home/ubuntu/minhasplantas/plantas/views.py
, line 46, in index
entries = Planta.objects.filter(status=True, timestamp__lte=timezone.now()).order_by(orderby)
active_cat = ''
context = {
'categories': Categoria.objects.filter(status=True).order_by('title'),
'active_cat': active_cat,
'entries': entries,
'active': random.choice(entries),…
'page_template': page_template,
}
if request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest':
template = page_template
Variable | Value |
---|---|
active_cat | <Categoria: gramas> |
cat | 'gramas' |
entries | <PlantaQuerySet []> |
orderby | '-timestamp' |
page_template | 'plantas/index_pagination.html' |
request | <WSGIRequest: GET '/plantas/categorias/gramas/'> |
template | 'plantas/index.html' |
/usr/lib/python3.10/random.py
, line 378, in choice
## -------------------- sequence methods -------------------
def choice(self, seq):
"""Choose a random element from a non-empty sequence."""
# raises IndexError if seq is empty
return seq[self._randbelow(len(seq))]…
def shuffle(self, x, random=None):
"""Shuffle list x in place, and return None.
Optional argument random is a 0-argument function returning a
random float in [0.0, 1.0); if it is the default None, the
Variable | Value |
---|---|
self | <random.Random object at 0x55f7fc9466b0> |
seq | <PlantaQuerySet []> |
/home/ubuntu/.env/2023/lib/python3.10/site-packages/django/db/models/query.py
, line 434, in __getitem__
(k.start is not None and k.start < 0)
or (k.stop is not None and k.stop < 0)
)
):
raise ValueError("Negative indexing is not supported.")
if self._result_cache is not None:
return self._result_cache[k]…
if isinstance(k, slice):
qs = self._chain()
if k.start is not None:
start = int(k.start)
else:
Variable | Value |
---|---|
k | 0 |
self | <PlantaQuerySet []> |
AnonymousUser
No GET data
No POST data
No FILES data
No cookie data
Variable | Value |
---|---|
HTTP_ACCEPT | '*/*' |
HTTP_CONNECTION | 'close' |
HTTP_HOST | 'minhasplantas.com.br' |
HTTP_REFERER | 'http://minhasplantas.com.br/plantas/categorias/gramas/' |
HTTP_USER_AGENT | 'claudebot' |
HTTP_X_AMZN_TRACE_ID | 'Root=1-6605c729-42eb710844a289ee1c8b513c' |
HTTP_X_FORWARDED_FOR | '54.211.203.45, 172.31.12.192' |
HTTP_X_FORWARDED_PORT | '443' |
HTTP_X_FORWARDED_PROTO | 'http' |
HTTP_X_REAL_IP | '172.31.12.192' |
PATH_INFO | '/plantas/categorias/gramas/' |
QUERY_STRING | '' |
RAW_URI | '/plantas/categorias/gramas/' |
REMOTE_ADDR | '' |
REQUEST_METHOD | 'GET' |
SCRIPT_NAME | '' |
SERVER_NAME | 'minhasplantas.com.br' |
SERVER_PORT | '80' |
SERVER_PROTOCOL | 'HTTP/1.0' |
SERVER_SOFTWARE | 'gunicorn/21.2.0' |
gunicorn.socket | <socket.socket fd=9, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=/home/ubuntu/minhasplantas/app.sock> |
wsgi.errors | <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f9ae8fca6e0> |
wsgi.file_wrapper | <class 'gunicorn.http.wsgi.FileWrapper'> |
wsgi.input | <gunicorn.http.body.Body object at 0x7f9ae8fca1a0> |
wsgi.input_terminated | True |
wsgi.multiprocess | True |
wsgi.multithread | False |
wsgi.run_once | False |
wsgi.url_scheme | 'http' |
wsgi.version | (1, 0) |
minhasplantas.settings
Setting | Value |
---|---|
ABSOLUTE_URL_OVERRIDES | {} |
ADMINS | [] |
ALLOWED_HOSTS | ['localhost', '35.82.33.27', 'minhasplantas.com.br'] |
APPEND_SLASH | True |
AUTHENTICATION_BACKENDS | ['django.contrib.auth.backends.ModelBackend'] |
AUTH_PASSWORD_VALIDATORS | '********************' |
AUTH_USER_MODEL | 'auth.User' |
AWS_ACCESS_KEY_ID | '********************' |
AWS_HEADERS | {'Cache-Control': 'max-age=94608000', 'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT'} |
AWS_S3_CUSTOM_DOMAIN | 'minhasplantas3.s3.amazonaws.com' |
AWS_S3_FILE_OVERWRITE | False |
AWS_SECRET_ACCESS_KEY | '********************' |
AWS_STORAGE_BUCKET_NAME | 'minhasplantas3' |
BASE_DIR | PosixPath('/home/ubuntu/minhasplantas') |
CACHES | {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} |
CACHE_MIDDLEWARE_ALIAS | 'default' |
CACHE_MIDDLEWARE_KEY_PREFIX | '********************' |
CACHE_MIDDLEWARE_SECONDS | 600 |
CKEDITOR_CONFIGS | {'default': {'entities': False, 'entities_latin': False, 'extraPlugins': 'youtube', 'height': 300, 'removePlugins': 'iframe', 'toolbar': 'Custom', 'toolbar_Custom': [['Bold', 'Italic', 'Underline'], ['TextColor', 'BGColor'], ['Image', 'Youtube'], ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Link', 'Unlink'], ['Blockquote'], ['Styles', 'Format', 'Font', 'FontSize'], ['Undo', 'Redo'], ['Maximize', 'RemoveFormat', 'Source']], 'width': '100%'}} |
CKEDITOR_UPLOAD_PATH | 'uploads/' |
CSRF_COOKIE_AGE | 31449600 |
CSRF_COOKIE_DOMAIN | None |
CSRF_COOKIE_HTTPONLY | False |
CSRF_COOKIE_NAME | 'csrftoken' |
CSRF_COOKIE_PATH | '/' |
CSRF_COOKIE_SAMESITE | 'Lax' |
CSRF_COOKIE_SECURE | True |
CSRF_FAILURE_VIEW | 'django.views.csrf.csrf_failure' |
CSRF_HEADER_NAME | 'HTTP_X_CSRFTOKEN' |
CSRF_TRUSTED_ORIGINS | ['https://minhasplantas.com.br'] |
CSRF_USE_SESSIONS | False |
DATABASES | {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_HEALTH_CHECKS': False, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql', 'HOST': 'minhasplantas.c3o6awgw7ywv.us-west-2.rds.amazonaws.com', 'NAME': 'minhasplantas', 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': 5432, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'minhasplantas'}} |
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.BigAutoField' |
DEFAULT_CHARSET | 'utf-8' |
DEFAULT_EXCEPTION_REPORTER | 'django.views.debug.ExceptionReporter' |
DEFAULT_EXCEPTION_REPORTER_FILTER | 'django.views.debug.SafeExceptionReporterFilter' |
DEFAULT_FILE_STORAGE | 'minhasplantas.custom_storages.MediaStorage' |
DEFAULT_FROM_EMAIL | 'contato@minhasplantas.com.br' |
DEFAULT_INDEX_TABLESPACE | '' |
DEFAULT_TABLESPACE | '' |
DEFAULT_TO_EMAIL | 'contato@minhasplantas.com.br' |
DISALLOWED_USER_AGENTS | [] |
EMAIL_BACKEND | 'django.core.mail.backends.smtp.EmailBackend' |
EMAIL_HOST | 'smtp.gmail.com' |
EMAIL_HOST_PASSWORD | '********************' |
EMAIL_HOST_USER | 'contato@minhasplantas.com.br' |
EMAIL_PORT | 587 |
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 | True |
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 |
FORMS_URLFIELD_ASSUME_HTTPS | False |
FORM_RENDERER | 'django.forms.renderers.DjangoTemplates' |
IGNORABLE_404_URLS | [] |
INSTALLED_APPS | ['tags.apps.TagsConfig', 'search.apps.SearchConfig', 'logs.apps.LogsConfig', 'ads.apps.AdsConfig', 'support.apps.SupportConfig', 'home.apps.HomeConfig', 'audios.apps.AudiosConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sitemaps', 'ckeditor', 'ckeditor_uploader', 'fontawesomefree', 'mailing.apps.MailingConfig', 'blog.apps.BlogConfig', 'blogs.apps.BlogsConfig', 'fotografos.apps.FotografosConfig', 'plantas.apps.PlantasConfig', 'radio.apps.RadioConfig', 'tv.apps.TvConfig', 'duvidas.apps.DuvidasConfig', 'galeria.apps.GaleriaConfig', 'culinaria.apps.CulinariaConfig', 'eventos.apps.EventosConfig', 'cursos.apps.CursosConfig', 'loja.apps.LojaConfig', 'contato.apps.ContatoConfig', 'storages', 'el_pagination'] |
INTERNAL_IPS | [] |
LANGUAGES | [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('ckb', 'Central Kurdish (Sorani)'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('ms', 'Malay'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('ug', 'Uyghur'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')] |
LANGUAGES_BIDI | ['he', 'ar', 'ar-dz', 'ckb', 'fa', 'ug', 'ur'] |
LANGUAGE_CODE | 'pt-br' |
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 | [] |
LOGGING | {} |
LOGGING_CONFIG | 'logging.config.dictConfig' |
LOGIN_REDIRECT_URL | '/accounts/profile/' |
LOGIN_URL | '/accounts/login/' |
LOGOUT_REDIRECT_URL | None |
MANAGERS | [] |
MEDIAFILES_LOCATION | 'media' |
MEDIA_ROOT | PosixPath('/home/ubuntu/minhasplantas/../media') |
MEDIA_URL | 'https://minhasplantas3.s3.amazonaws.com/media/' |
MESSAGE_STORAGE | 'django.contrib.messages.storage.fallback.FallbackStorage' |
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'] |
MIGRATION_MODULES | {} |
MONTH_DAY_FORMAT | 'F j' |
NUMBER_GROUPING | 0 |
PASSWORD_HASHERS | '********************' |
PASSWORD_RESET_TIMEOUT | '********************' |
PREPEND_WWW | False |
ROOT_URLCONF | 'minhasplantas.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 | ('HTTP_X_FORWARDED_PROTO', 'https') |
SECURE_REDIRECT_EXEMPT | [] |
SECURE_REFERRER_POLICY | 'same-origin' |
SECURE_SSL_HOST | None |
SECURE_SSL_REDIRECT | False |
SERVER_EMAIL | 'contato@minhasplantas.com.br' |
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 | True |
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 | 'minhasplantas.settings' |
SHORT_DATETIME_FORMAT | 'm/d/Y P' |
SHORT_DATE_FORMAT | 'm/d/Y' |
SIGNING_BACKEND | 'django.core.signing.TimestampSigner' |
SILENCED_SYSTEM_CHECKS | [] |
SITE_ID | 1 |
STATICFILES_DIRS | (PosixPath('/home/ubuntu/minhasplantas/static'),) |
STATICFILES_FINDERS | ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder'] |
STATICFILES_LOCATION | 'static' |
STATICFILES_STORAGE | 'django.contrib.staticfiles.storage.StaticFilesStorage' |
STATIC_ROOT | PosixPath('/home/ubuntu/minhasplantas/../static') |
STATIC_URL | '/static/' |
STORAGES | {'default': {'BACKEND': 'minhasplantas.custom_storages.MediaStorage'}, 'staticfiles': {'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage'}} |
TEMPLATES | [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [PosixPath('/home/ubuntu/minhasplantas/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 | 'America/Sao_Paulo' |
USE_I18N | True |
USE_THOUSAND_SEPARATOR | False |
USE_TZ | True |
USE_X_FORWARDED_HOST | False |
USE_X_FORWARDED_PORT | False |
WSGI_APPLICATION | 'minhasplantas.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.