arbuz-team / asbhp

3 stars 0 forks source link

Fajny błąd ;) #56

Closed dbetka closed 8 years ago

dbetka commented 8 years ago

@arbuz93 -> Napraw KeyError at /wyszukiwarka/usun_sesje_filtrow/

'wyszukiwarka'

Request Method: GET Request URL: http://127.0.0.1:8000/wyszukiwarka/usun_sesje_filtrow/ Django Version: 1.9.7 Exception Type: KeyError Exception Value:

'wyszukiwarka'

Exception Location: /usr/local/lib/python3.5/dist-packages/django/contrib/sessions/backends/base.py in delitem, line 57 Python Executable: /usr/bin/python3 Python Version: 3.5.1 Python Path:

['/home/mrskull/Dokumenty/Projekty/asbhp', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']

Server time: Śr, 20 Lip 2016 18:56:21 +0000

Traceback Switch to copy-and-paste view

/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py in get_response

                        response = self.process_exception_by_middleware(e, request)

     ...
▶ Local vars
/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py in get_response

                        response = wrapped_callback(request, *callback_args, **callback_kwargs)

     ...
▶ Local vars
/home/mrskull/Dokumenty/Projekty/asbhp/dodatek/views.py in Usun_Sesje_Filtrow

        Usun_Sesje_Wyszukiwarki(request)

     ...
▶ Local vars
/home/mrskull/Dokumenty/Projekty/asbhp/dodatek/views.py in Usun_Sesje_Wyszukiwarki

        del request.session['wyszukiwarka']

     ...
▶ Local vars
/usr/local/lib/python3.5/dist-packages/django/contrib/sessions/backends/base.py in __delitem__

            del self._session[key]

     ...
▶ Local vars

Request information GET

No GET data POST

No POST data FILES

No FILES data COOKIES Variable Value csrftoken

'ES2i9xhqOTdh1XpEpMRcSv4wl4Ba4Xdk'

sessionid

'u3y1maekeb2rqbr5hk0o6aagpjtsh877'

META Variable Value PATH

'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'

HTTP_REFERER

'http://127.0.0.1:8000/oferta/'

GATEWAY_INTERFACE

'CGI/1.1'

CSRF_COOKIE

'ES2i9xhqOTdh1XpEpMRcSv4wl4Ba4Xdk'

PATH_INFO

'/wyszukiwarka/usun_sesje_filtrow/'

DBUS_SESSION_BUS_ADDRESS

'unix:abstract=/tmp/dbus-9dk6yEsPQg,guid=401ba8ad8a4c963ddb5a73ba578e589d'

GDMSESSION

'Lubuntu'

XDG_SESSION_TYPE

'x11'

HOME

'/home/mrskull'

LC_IDENTIFICATION

'pl_PL.UTF-8'

wsgi.file_wrapper

''

XDG_MENU_PREFIX

'lxde-'

USER

'mrskull'

DISPLAY

':0'

QT4_IM_MODULE

'xim'

TZ

'UTC'

wsgi.run_once

False

LANGUAGE

'pl:en'

DEFAULTS_PATH

'/usr/share/gconf/Lubuntu.default.path'

wsgi.version

(1, 0)

SAL_USE_VCLPLUGIN

'gtk'

LC_MONETARY

'pl_PL.UTF-8'

SERVER_PROTOCOL

'HTTP/1.1'

SSH_AGENT_PID

'976'

XDG_VTNR

'7'

XAUTHORITY

'/home/mrskull/.Xauthority'

GDM_LANG

'pl'

HTTP_ACCEPT

'text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8'

MANDATORY_PATH

'/usr/share/gconf/Lubuntu.mandatory.path'

XDG_SESSION_PATH

'/org/freedesktop/DisplayManager/Session0'

SSH_AUTH_SOCK

'/tmp/ssh-FqL211TtKRjp/agent.846'

HTTP_ACCEPT_LANGUAGE

'en-US,en;q=0.5'

XMODIFIERS

'@im=none'

_LXSESSION_PID

'846'

__fish_help_dir

'/usr/share/doc/fish'

REMOTE_HOST

''

HTTP_CONNECTION

'keep-alive'

wsgi.multiprocess

False

LC_NAME

'pl_PL.UTF-8'

SCRIPT_NAME

''

SHLVL

'1'

LC_TELEPHONE

'pl_PL.UTF-8'

REQUEST_METHOD

'GET'

SERVER_NAME

'localhost'

HTTP_COOKIE

('sessionid=u3y1maekeb2rqbr5hk0o6aagpjtsh877; ' 'csrftoken=ES2i9xhqOTdh1XpEpMRcSv4wl4Ba4Xdk')

SERVER_PORT

'8000'

CONTENT_TYPE

'text/plain'

HTTP_HOST

'127.0.0.1:8000'

XDG_CONFIG_HOME

'/home/mrskull/.config'

QT_QPA_PLATFORMTHEME

'lxqt'

LC_ADDRESS

'pl_PL.UTF-8'

HTTP_ACCEPT_ENCODING

'gzip, deflate'

LC_PAPER

'pl_PL.UTF-8'

XDG_GREETER_DATA_DIR

'/var/lib/lightdm-data/mrskull'

GTK_IM_MODULE

'xim'

__fish_bin_dir

'/usr/bin'

XDG_CURRENT_DESKTOP

'LXDE'

SERVER_SOFTWARE

'WSGIServer/0.2'

CLUTTER_IM_MODULE

'xim'

XDG_SESSION_DESKTOP

'Lubuntu'

PWD

'/home/mrskull/Dokumenty/Projekty/asbhp'

LC_NUMERIC

'pl_PL.UTF-8'

DESKTOP_SESSION

'Lubuntu'

SHELL

'/usr/bin/fish'

QT_PLATFORM_PLUGIN

'lxqt'

XDG_SEAT

'seat0'

REMOTE_ADDR

'127.0.0.1'

DJANGO_SETTINGS_MODULE

'arbuz.settings'

TERM

'xterm'

LOGNAME

'mrskull'

wsgi.url_scheme

'http'

RUN_MAIN

'true'

wsgi.input

<_io.BufferedReader name=6> XDG_SEAT_PATH '/org/freedesktop/DisplayManager/Seat0' __fish_datadir '/usr/share/fish' __fish_sysconfdir '/etc/fish' QUERY_STRING '' CONTENT_LENGTH '' XDG_SESSION_ID 'c1' HTTP_USER_AGENT 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0' XDG_DATA_DIRS '/etc/xdg/lubuntu:/usr/local/share:/usr/share:/usr/share/gdm:/var/lib/menu-xdg:/usr/share/Lubuntu:/usr/local/share/:/usr/share/' XDG_CONFIG_DIRS '/etc/xdg/lubuntu:/etc/xdg/xdg-Lubuntu:/etc/xdg' LANG 'pl_PL.UTF-8' wsgi.multithread True LC_MEASUREMENT 'pl_PL.UTF-8' wsgi.errors <_io.TextIOWrapper name='' mode='w' encoding='UTF-8'> XDG_RUNTIME_DIR '/run/user/1000' LC_TIME 'pl_PL.UTF-8' Settings Using settings module arbuz.settings Setting Value USE_X_FORWARDED_HOST False TEMPLATE_DEBUG False FORMAT_MODULE_PATH None CACHE_MIDDLEWARE_KEY_PREFIX '********************' INSTALLED_APPS ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'asbhp', 'wyszukiwarka', 'produkt', 'dodatek', 'uzytkownik', 'komunikat', 'poczta'] USE_TZ True LANGUAGE_COOKIE_AGE None TIME_FORMAT 'P' FILE_UPLOAD_TEMP_DIR None USE_ETAGS False STATICFILES_DIRS ('/home/mrskull/Dokumenty/Projekty/asbhp/static',) TEST_NON_SERIALIZED_APPS [] DATABASE_ROUTERS [] SECURE_REDIRECT_EXEMPT [] EMAIL_HOST 'smtp.gmail.com' SECURE_SSL_HOST None SESSION_COOKIE_NAME 'sessionid' SECURE_SSL_REDIRECT False TIME_INPUT_FORMATS ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M'] CSRF_TRUSTED_ORIGINS [] DEFAULT_FILE_STORAGE 'django.core.files.storage.FileSystemStorage' DEFAULT_FROM_EMAIL 'webmaster@localhost' ROOT_URLCONF 'arbuz.urls' CSRF_COOKIE_AGE 31449600 TIME_ZONE 'UTC' DATE_FORMAT 'N j, Y' PASSWORD_RESET_TIMEOUT_DAYS '********************' PASSWORD_HASHERS '********************' DEBUG_PROPAGATE_EXCEPTIONS False FILE_CHARSET 'utf-8' USE_I18N True LANGUAGE_CODE 'pl' DATABASES {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': '/home/mrskull/Dokumenty/Projekty/asbhp/db.sqlite3', 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}} DATETIME_INPUT_FORMATS ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y'] SECURE_CONTENT_TYPE_NOSNIFF False YEAR_MONTH_FORMAT 'F Y' USE_L10N True SILENCED_SYSTEM_CHECKS [] ADMINS [] LOGGING {} LANGUAGE_COOKIE_PATH '/' STATIC_ROOT None CSRF_COOKIE_HTTPONLY False WSGI_APPLICATION 'arbuz.wsgi.application' TEMPLATE_DIRS [] IGNORABLE_404_URLS [] CSRF_COOKIE_SECURE False MONTH_DAY_FORMAT 'F j' FORCE_SCRIPT_NAME None LOGGING_CONFIG 'logging.config.dictConfig' SESSION_SERIALIZER 'django.contrib.sessions.serializers.JSONSerializer' SECURE_HSTS_INCLUDE_SUBDOMAINS False EMAIL_SSL_CERTFILE None EMAIL_HOST_PASSWORD '********************' SESSION_FILE_PATH None SESSION_EXPIRE_AT_BROWSER_CLOSE False EMAIL_USE_SSL False BASE_DIR '/home/mrskull/Dokumenty/Projekty/asbhp' STATIC_URL '/static/' CSRF_HEADER_NAME 'HTTP_X_CSRFTOKEN' SHORT_DATETIME_FORMAT 'm/d/Y P' EMAIL_TIMEOUT None DEBUG True LANGUAGE_COOKIE_DOMAIN None DEFAULT_INDEX_TABLESPACE '' CSRF_FAILURE_VIEW 'django.views.csrf.csrf_failure' SESSION_COOKIE_DOMAIN None INTERNAL_IPS [] MESSAGE_STORAGE 'django.contrib.messages.storage.fallback.FallbackStorage' SESSION_COOKIE_AGE 1209600 TEMPLATE_STRING_IF_INVALID '' X_FRAME_OPTIONS 'SAMEORIGIN' SECURE_BROWSER_XSS_FILTER False USE_X_FORWARDED_PORT False SETTINGS_MODULE 'arbuz.settings' MEDIA_URL '/static/tmp/' DEFAULT_EXCEPTION_REPORTER_FILTER 'django.views.debug.SafeExceptionReporterFilter' MEDIA_ROOT '/home/mrskull/Dokumenty/Projekty/asbhp/static/tmp' LOGIN_REDIRECT_URL '/accounts/profile/' SERVER_EMAIL 'root@localhost' FILE_UPLOAD_DIRECTORY_PERMISSIONS None 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'] SECURE_PROXY_SSL_HEADER None CACHE_MIDDLEWARE_SECONDS 600 SESSION_SAVE_EVERY_REQUEST False SESSION_COOKIE_SECURE False TEMPLATE_CONTEXT_PROCESSORS ['django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages'] TEMPLATES [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/home/mrskull/Dokumenty/Projekty/asbhp/static/html', '/home/mrskull/Dokumenty/Projekty/asbhp/html'], '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']}}] NUMBER_GROUPING 0 CACHES {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} EMAIL_SSL_KEYFILE '********************' SIGNING_BACKEND 'django.core.signing.TimestampSigner' LOCALE_PATHS [] ALLOWED_HOSTS ['asbhp.arbuz.team'] USE_THOUSAND_SEPARATOR False MIGRATION_MODULES {} EMAIL_HOST_USER 'kontakt.arbuz.team@gmail.com' AUTHENTICATION_BACKENDS ['django.contrib.auth.backends.ModelBackend'] STATICFILES_STORAGE 'django.contrib.staticfiles.storage.StaticFilesStorage' PREPEND_WWW False FILE_UPLOAD_PERMISSIONS None FILE_UPLOAD_HANDLERS ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler'] DISALLOWED_USER_AGENTS [] ALLOWED_INCLUDE_ROOTS [] SESSION_COOKIE_HTTPONLY True DEFAULT_CHARSET 'utf-8' CSRF_COOKIE_DOMAIN None AUTH_USER_MODEL 'auth.User' TEMPLATE_LOADERS ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader'] CSRF_COOKIE_PATH '/' LANGUAGES_BIDI ['he', 'ar', 'fa', 'ur'] SECURE_HSTS_SECONDS 0 DEFAULT_TABLESPACE '' SECRET_KEY '********************' SHORT_DATE_FORMAT 'm/d/Y' LANGUAGES [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('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'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('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'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')] EMAIL_USE_TLS True AUTH_PASSWORD_VALIDATORS '********************' THOUSAND_SEPARATOR ',' DECIMAL_SEPARATOR '.' FILE_UPLOAD_MAX_MEMORY_SIZE 2621440 ABSOLUTE_URL_OVERRIDES {} DATETIME_FORMAT 'N j, Y, P' SESSION_CACHE_ALIAS 'default' CACHE_MIDDLEWARE_ALIAS 'default' CSRF_COOKIE_NAME 'csrftoken' LANGUAGE_COOKIE_NAME 'django_language' APPEND_SLASH True SESSION_COOKIE_PATH '/' EMAIL_SUBJECT_PREFIX '[Django] ' MANAGERS [] LOGIN_URL '/accounts/login/' STATICFILES_FINDERS ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder'] TEST_RUNNER 'django.test.runner.DiscoverRunner' FIRST_DAY_OF_WEEK 0 SESSION_ENGINE 'django.contrib.sessions.backends.cache' MIDDLEWARE_CLASSES ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] FIXTURE_DIRS [] EMAIL_BACKEND 'django.core.mail.backends.smtp.EmailBackend' LOGOUT_URL '/accounts/logout/' DEFAULT_CONTENT_TYPE 'text/html' EMAIL_PORT 587 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.
dbetka commented 8 years ago

zrzut ekranu 2016-07-20 20 59 35

arbuz93 commented 8 years ago

Błąd wyskoczył prawdopodobnie z powodu próby usunięcia z sesji nieistniejących wartości. Problem powstaje wtedy, gdy dla nowego użytkownika zostanie uruchomiona funkcja usuwania całej sesji przed wczytaniem jakiejkolwiek podstrony tej strony internetowej. Nie będę pisał zabezpieczeń, bo bardzo mało możliwe jest, żeby uruchomić te funkcję. Ktoś musiałby wysłać do innej osoby adres przycisku czyszczenia sesji. Zakładam, że najpierw zainteresowany wejdzie na stronę, a później zaczeni używać jej funkcji. Inaczej będzie za dużo dodatkowych warunków, które tylko spowolnią działanie strony.