'NoneType' object has no attribute 'context'
Request Method: | GET |
---|---|
Request URL: | http://tia.talentsprint.com/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam |
Django Version: | 1.10.6 |
Exception Type: | AttributeError |
Exception Value: | 'NoneType' object has no attribute 'context' |
Exception Location: | /home/tia/code/reports/views.py in show_sample_report, line 105 |
Python Executable: | /home/tia/venv/bin/python2 |
Python Version: | 2.7.12 |
Python Path: | ['/home/tia/code', '/home/tia/venv/bin', '/home/tia/venv/lib/python2.7', '/home/tia/venv/lib/python2.7/plat-x86_64-linux-gnu', '/home/tia/venv/lib/python2.7/lib-tk', '/home/tia/venv/lib/python2.7/lib-old', '/home/tia/venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/tia/venv/local/lib/python2.7/site-packages', '/home/tia/code', '/home/tia/code'] |
Server time: | Fri, 29 Mar 2024 08:18:33 +0000 |
/home/tia/venv/local/lib/python2.7/site-packages/django/core/handlers/exception.py
in inner
This decorator is automatically applied to all middleware to ensure that
no middleware leaks an exception and that the next middleware in the stack
can rely on getting a response instead of an exception.
"""
@wraps(get_response, assigned=available_attrs(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 'context'",) |
get_response | <bound method WSGIHandler._legacy_get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x7f40ad1f13d0>> |
request | <WSGIRequest: GET '/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam'> |
/home/tia/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py
in _legacy_get_response
# Apply request middleware
for middleware_method in self._request_middleware:
response = middleware_method(request)
if response:
break
if response is None:
response = self._get_response(request)...
return response
Variable | Value |
---|---|
middleware_method | <bound method MessageMiddleware.process_request of <django.contrib.messages.middleware.MessageMiddleware object at 0x7f40ab9c4410>> |
request | <WSGIRequest: GET '/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam'> |
response | None |
self | <django.core.handlers.wsgi.WSGIHandler object at 0x7f40ad1f13d0> |
/home/tia/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py
in _get_response
break
if response is None:
wrapped_callback = self.make_view_atomic(callback)
try:
response = wrapped_callback(request, *callback_args, **callback_kwargs)
except Exception as e:
response = self.process_exception_by_middleware(e, request)...
# Complain if the view returned None (a common error).
if response is None:
if isinstance(callback, types.FunctionType): # FBV
view_name = callback.__name__
else: # CBV
Variable | Value |
---|---|
callback | <function show_sample_report at 0x7f40aa929848> |
callback_args | () |
callback_kwargs | {} |
e | AttributeError("'NoneType' object has no attribute 'context'",) |
middleware_method | <bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x7f40ab9b9ed0>> |
request | <WSGIRequest: GET '/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam'> |
resolver | <RegexURLResolver 'TIA.urls' (None:None) ^/> |
resolver_match | ResolverMatch(func=reports.views.show_sample_report, args=(), kwargs={}, url_name=sample_report, app_names=[], namespaces=[]) |
response | None |
self | <django.core.handlers.wsgi.WSGIHandler object at 0x7f40ad1f13d0> |
wrapped_callback | <function show_sample_report at 0x7f40aa929848> |
/home/tia/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py
in _get_response
response = middleware_method(request, callback, callback_args, callback_kwargs)
if response:
break
if response is None:
wrapped_callback = self.make_view_atomic(callback)
try:
response = wrapped_callback(request, *callback_args, **callback_kwargs)...
except Exception as e:
response = self.process_exception_by_middleware(e, request)
# Complain if the view returned None (a common error).
if response is None:
if isinstance(callback, types.FunctionType): # FBV
Variable | Value |
---|---|
callback | <function show_sample_report at 0x7f40aa929848> |
callback_args | () |
callback_kwargs | {} |
e | AttributeError("'NoneType' object has no attribute 'context'",) |
middleware_method | <bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x7f40ab9b9ed0>> |
request | <WSGIRequest: GET '/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam'> |
resolver | <RegexURLResolver 'TIA.urls' (None:None) ^/> |
resolver_match | ResolverMatch(func=reports.views.show_sample_report, args=(), kwargs={}, url_name=sample_report, app_names=[], namespaces=[]) |
response | None |
self | <django.core.handlers.wsgi.WSGIHandler object at 0x7f40ad1f13d0> |
wrapped_callback | <function show_sample_report at 0x7f40aa929848> |
/home/tia/code/reports/views.py
in show_sample_report
context = json.loads(exam.context)
sample_email = context["sample_email"]
# Get Sample Report email
student = Students.objects.get(email=sample_email)
data = Reports.objects.filter(
exam_id=exam.id, student_id=student.id).first()
context = json.loads(data.context)...
context.update({"test_date_raw": exam.test_date, "email": student.email})
context["overall_time_spent_chart_data"] = map(
lambda x: x / 60.0, context["overall_time_spent_chart_data"])
context[
"student_name"] = '<img src="https://www.talentsprint.com/misc/name-blur.png">'
Variable | Value |
---|---|
context | {u'attempted_email_subject': u'Your Performance in AIM SBI Clerk Mains', u'exam_id': 557, u'folder_path': u'/home/tia/code/temp/2018-07-23__All_India_SBI_Clerk_Mains_Mock_Exam_2018-07-21_bank', u'mailIds': u'naveensai.n@talentsprint.com', u'next_test_date_formatted': u'July 28, 2018', u'not_attempted_email_subject': u'Your AIM Exam Report - Practice Makes Perfect!', u'overall_cutoff': 107.0, u'overall_max_score': 200, u'platform': u'bank', u'questionpaper_ids': [5550, 5525, 5524, 5551], u'sample_email': u'capachpande@rediffmail.com', u'subject_order': [u'Reasoning & Computer Aptitude', u'English Language', u'Quantitative Aptitude', u'General/Financial Awareness'], u'subjects': {u'English Language': {u'cutoff_score': 13.5, u'display_name': u'English Language', u'max_score': 40.0, u'penalty': 0.25, u'questions': 40, u'weight': 1.0}, u'General/Financial Awareness': {u'cutoff_score': 19.25, u'display_name': u'General/Financial Awareness', u'max_score': 50.0, u'penalty': 0.25, u'questions': 50, u'weight': 1.0}, u'Quantitative Aptitude': {u'cutoff_score': 20.75, u'display_name': u'Quantitative Aptitude', u'max_score': 50.0, u'penalty': 0.25, u'questions': 50, u'weight': 1.0}, u'Reasoning & Computer Aptitude': {u'cutoff_score': 37.5, u'display_name': u'Reasoning & Computer Aptitude', u'max_score': 60.0, u'penalty': 0.3, u'questions': 50, u'weight': 1.2}}, u'test_date': u'2018-07-21', u'test_date_formatted': u'July 21-22, 2018', u'test_duration': 8600, u'test_name': u'All India SBI Clerk Mains Mock Exam', u'toppers': [[u'nilabhm4@gmail.com', 1, u'Nilabhm', u'Lucknow', u'43.50', u'30.00', u'30.25', u'45.25', u'149.00'], [u'mpa.ashok94@yahoo.com', 2, u'Ashok', u'Bangalore', u'46.80', u'21.00', u'28.75', u'36.75', u'133.30'], [u'aarthiashokkumar18@gmail.com', 3, u'Aarthi', u'Palakkad', u'44.10', u'16.00', u'22.50', u'46.25', u'128.85'], [u'jayamuraliemail@gmail.com', 4, u'Jayamurali', u'Thrissur', u'39.60', u'26.25', u'22.75', u'40.00', u'128.60'], [u'thakur15abhishek@gmail.com', 5, u'Abhishek Thakur', u'Pune', u'46.50', u'21.00', u'35.75', u'21.00', u'124.25']]} |
data | None |
exam | <Exam: Exam object> |
request | <WSGIRequest: GET '/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam'> |
sample_email | u'capachpande@rediffmail.com' |
student | <Students: Students object> |
AnonymousUser
Variable | Value |
---|---|
test_date | u'2018-07-21' |
test_name | u'All India SBI Clerk Mains Mock Exam' |
No POST data
No FILES data
No cookie data
Variable | Value |
---|---|
HTTP_ACCEPT | '*/*' |
HTTP_CONNECTION | 'close' |
HTTP_HOST | 'tia.talentsprint.com' |
HTTP_USER_AGENT | 'claudebot' |
HTTP_X_FORWARDED_FOR | '35.170.54.171' |
HTTP_X_REAL_IP | '35.170.54.171' |
PATH_INFO | u'/reports/sample-report/' |
QUERY_STRING | 'test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam' |
RAW_URI | '/reports/sample-report/?test_date=2018-07-21&test_name=All+India+SBI+Clerk+Mains+Mock+Exam' |
REMOTE_ADDR | '127.0.0.1' |
REMOTE_PORT | '35974' |
REQUEST_METHOD | 'GET' |
SCRIPT_NAME | u'' |
SERVER_NAME | '0.0.0.0' |
SERVER_PORT | '9999' |
SERVER_PROTOCOL | 'HTTP/1.0' |
SERVER_SOFTWARE | 'gunicorn/19.7.0' |
gunicorn.socket | <socket._socketobject object at 0x7f4095241ad0> |
wsgi.errors | <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f4095219f50> |
wsgi.file_wrapper | '' |
wsgi.input | <gunicorn.http.body.Body object at 0x7f4095219690> |
wsgi.multiprocess | False |
wsgi.multithread | False |
wsgi.run_once | False |
wsgi.url_scheme | 'http' |
wsgi.version | (1, 0) |
TIA.settings
Setting | Value |
---|---|
ABSOLUTE_URL_OVERRIDES | {} |
ADMINS | [] |
ALLOWED_HOSTS | ['tia.talentsprint.com', 'localhost'] |
APPEND_SLASH | True |
AUTHENTICATION_BACKENDS | [u'django.contrib.auth.backends.ModelBackend'] |
AUTH_PASSWORD_VALIDATORS | u'********************' |
AUTH_USER_MODEL | u'auth.User' |
BASE_DIR | '/home/tia/code' |
CACHES | {u'default': {u'BACKEND': u'django.core.cache.backends.locmem.LocMemCache'}} |
CACHE_MIDDLEWARE_ALIAS | u'default' |
CACHE_MIDDLEWARE_KEY_PREFIX | u'********************' |
CACHE_MIDDLEWARE_SECONDS | 600 |
CSRF_COOKIE_AGE | 31449600 |
CSRF_COOKIE_DOMAIN | None |
CSRF_COOKIE_HTTPONLY | False |
CSRF_COOKIE_NAME | u'csrftoken' |
CSRF_COOKIE_PATH | u'/' |
CSRF_COOKIE_SECURE | False |
CSRF_FAILURE_VIEW | u'django.views.csrf.csrf_failure' |
CSRF_HEADER_NAME | u'HTTP_X_CSRFTOKEN' |
CSRF_TRUSTED_ORIGINS | [] |
DATABASES | {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.mysql', 'HOST': '', 'NAME': 'tia', 'OPTIONS': {}, 'PASSWORD': u'********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'tia'}} |
DATABASE_ROUTERS | [] |
DATA_UPLOAD_MAX_MEMORY_SIZE | 2621440 |
DATA_UPLOAD_MAX_NUMBER_FIELDS | 1000 |
DATETIME_FORMAT | u'N j, Y, P' |
DATETIME_INPUT_FORMATS | [u'%Y-%m-%d %H:%M:%S', u'%Y-%m-%d %H:%M:%S.%f', u'%Y-%m-%d %H:%M', u'%Y-%m-%d', u'%m/%d/%Y %H:%M:%S', u'%m/%d/%Y %H:%M:%S.%f', u'%m/%d/%Y %H:%M', u'%m/%d/%Y', u'%m/%d/%y %H:%M:%S', u'%m/%d/%y %H:%M:%S.%f', u'%m/%d/%y %H:%M', u'%m/%d/%y'] |
DATE_FORMAT | u'N j, Y' |
DATE_INPUT_FORMATS | [u'%Y-%m-%d', u'%m/%d/%Y', u'%m/%d/%y', u'%b %d %Y', u'%b %d, %Y', u'%d %b %Y', u'%d %b, %Y', u'%B %d %Y', u'%B %d, %Y', u'%d %B %Y', u'%d %B, %Y'] |
DEBUG | True |
DEBUG_PROPAGATE_EXCEPTIONS | False |
DECIMAL_SEPARATOR | u'.' |
DEFAULT_CHARSET | u'utf-8' |
DEFAULT_CONTENT_TYPE | u'text/html' |
DEFAULT_EXCEPTION_REPORTER_FILTER | u'django.views.debug.SafeExceptionReporterFilter' |
DEFAULT_FILE_STORAGE | u'django.core.files.storage.FileSystemStorage' |
DEFAULT_FROM_EMAIL | u'webmaster@localhost' |
DEFAULT_INDEX_TABLESPACE | u'' |
DEFAULT_TABLESPACE | u'' |
DISALLOWED_USER_AGENTS | [] |
EMAIL_BACKEND | u'django.core.mail.backends.smtp.EmailBackend' |
EMAIL_HOST | u'localhost' |
EMAIL_HOST_PASSWORD | u'********************' |
EMAIL_HOST_USER | u'' |
EMAIL_PORT | 25 |
EMAIL_SSL_CERTFILE | None |
EMAIL_SSL_KEYFILE | u'********************' |
EMAIL_SUBJECT_PREFIX | u'[Django] ' |
EMAIL_TIMEOUT | None |
EMAIL_USE_SSL | False |
EMAIL_USE_TLS | False |
FILE_CHARSET | u'utf-8' |
FILE_UPLOAD_DIRECTORY_PERMISSIONS | None |
FILE_UPLOAD_HANDLERS | [u'django.core.files.uploadhandler.MemoryFileUploadHandler', u'django.core.files.uploadhandler.TemporaryFileUploadHandler'] |
FILE_UPLOAD_MAX_MEMORY_SIZE | 2621440 |
FILE_UPLOAD_PERMISSIONS | None |
FILE_UPLOAD_TEMP_DIR | None |
FIRST_DAY_OF_WEEK | 0 |
FIXTURE_DIRS | [] |
FORCE_SCRIPT_NAME | None |
FORMAT_MODULE_PATH | None |
IGNORABLE_404_URLS | [] |
INSTALLED_APPS | ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'reports', 'test_analysis', 'edx_reports'] |
INTERNAL_IPS | [] |
LANGUAGES | [(u'af', u'Afrikaans'), (u'ar', u'Arabic'), (u'ast', u'Asturian'), (u'az', u'Azerbaijani'), (u'bg', u'Bulgarian'), (u'be', u'Belarusian'), (u'bn', u'Bengali'), (u'br', u'Breton'), (u'bs', u'Bosnian'), (u'ca', u'Catalan'), (u'cs', u'Czech'), (u'cy', u'Welsh'), (u'da', u'Danish'), (u'de', u'German'), (u'dsb', u'Lower Sorbian'), (u'el', u'Greek'), (u'en', u'English'), (u'en-au', u'Australian English'), (u'en-gb', u'British English'), (u'eo', u'Esperanto'), (u'es', u'Spanish'), (u'es-ar', u'Argentinian Spanish'), (u'es-co', u'Colombian Spanish'), (u'es-mx', u'Mexican Spanish'), (u'es-ni', u'Nicaraguan Spanish'), (u'es-ve', u'Venezuelan Spanish'), (u'et', u'Estonian'), (u'eu', u'Basque'), (u'fa', u'Persian'), (u'fi', u'Finnish'), (u'fr', u'French'), (u'fy', u'Frisian'), (u'ga', u'Irish'), (u'gd', u'Scottish Gaelic'), (u'gl', u'Galician'), (u'he', u'Hebrew'), (u'hi', u'Hindi'), (u'hr', u'Croatian'), (u'hsb', u'Upper Sorbian'), (u'hu', u'Hungarian'), (u'ia', u'Interlingua'), (u'id', u'Indonesian'), (u'io', u'Ido'), (u'is', u'Icelandic'), (u'it', u'Italian'), (u'ja', u'Japanese'), (u'ka', u'Georgian'), (u'kk', u'Kazakh'), (u'km', u'Khmer'), (u'kn', u'Kannada'), (u'ko', u'Korean'), (u'lb', u'Luxembourgish'), (u'lt', u'Lithuanian'), (u'lv', u'Latvian'), (u'mk', u'Macedonian'), (u'ml', u'Malayalam'), (u'mn', u'Mongolian'), (u'mr', u'Marathi'), (u'my', u'Burmese'), (u'nb', u'Norwegian Bokm\xe5l'), (u'ne', u'Nepali'), (u'nl', u'Dutch'), (u'nn', u'Norwegian Nynorsk'), (u'os', u'Ossetic'), (u'pa', u'Punjabi'), (u'pl', u'Polish'), (u'pt', u'Portuguese'), (u'pt-br', u'Brazilian Portuguese'), (u'ro', u'Romanian'), (u'ru', u'Russian'), (u'sk', u'Slovak'), (u'sl', u'Slovenian'), (u'sq', u'Albanian'), (u'sr', u'Serbian'), (u'sr-latn', u'Serbian Latin'), (u'sv', u'Swedish'), (u'sw', u'Swahili'), (u'ta', u'Tamil'), (u'te', u'Telugu'), (u'th', u'Thai'), (u'tr', u'Turkish'), (u'tt', u'Tatar'), (u'udm', u'Udmurt'), (u'uk', u'Ukrainian'), (u'ur', u'Urdu'), (u'vi', u'Vietnamese'), (u'zh-hans', u'Simplified Chinese'), (u'zh-hant', u'Traditional Chinese')] |
LANGUAGES_BIDI | [u'he', u'ar', u'fa', u'ur'] |
LANGUAGE_CODE | 'en-us' |
LANGUAGE_COOKIE_AGE | None |
LANGUAGE_COOKIE_DOMAIN | None |
LANGUAGE_COOKIE_NAME | u'django_language' |
LANGUAGE_COOKIE_PATH | u'/' |
LOCALE_PATHS | [] |
LOGGING | {} |
LOGGING_CONFIG | u'logging.config.dictConfig' |
LOGIN_REDIRECT_URL | u'/accounts/profile/' |
LOGIN_URL | u'/accounts/login/' |
LOGOUT_REDIRECT_URL | None |
MANAGERS | [] |
MEDIA_ROOT | '/home/tia/code/uploads/' |
MEDIA_URL | '/media/' |
MESSAGE_STORAGE | u'django.contrib.messages.storage.fallback.FallbackStorage' |
MIDDLEWARE | None |
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'] |
MIGRATION_MODULES | {} |
MONTH_DAY_FORMAT | u'F j' |
NUMBER_GROUPING | 0 |
PASSWORD_HASHERS | u'********************' |
PASSWORD_RESET_TIMEOUT_DAYS | u'********************' |
PREPEND_WWW | False |
ROOT_URLCONF | 'TIA.urls' |
SECRET_KEY | u'********************' |
SECURE_BROWSER_XSS_FILTER | False |
SECURE_CONTENT_TYPE_NOSNIFF | False |
SECURE_HSTS_INCLUDE_SUBDOMAINS | False |
SECURE_HSTS_SECONDS | 0 |
SECURE_PROXY_SSL_HEADER | None |
SECURE_REDIRECT_EXEMPT | [] |
SECURE_SSL_HOST | None |
SECURE_SSL_REDIRECT | False |
SERVER_EMAIL | u'root@localhost' |
SESSION_CACHE_ALIAS | u'default' |
SESSION_COOKIE_AGE | 1800 |
SESSION_COOKIE_DOMAIN | None |
SESSION_COOKIE_HTTPONLY | True |
SESSION_COOKIE_NAME | u'sessionid' |
SESSION_COOKIE_PATH | u'/' |
SESSION_COOKIE_SECURE | False |
SESSION_ENGINE | u'django.contrib.sessions.backends.db' |
SESSION_EXPIRE_AT_BROWSER_CLOSE | False |
SESSION_FILE_PATH | None |
SESSION_SAVE_EVERY_REQUEST | False |
SESSION_SERIALIZER | u'django.contrib.sessions.serializers.JSONSerializer' |
SETTINGS_MODULE | 'TIA.settings' |
SHORT_DATETIME_FORMAT | u'm/d/Y P' |
SHORT_DATE_FORMAT | u'm/d/Y' |
SIGNING_BACKEND | u'django.core.signing.TimestampSigner' |
SILENCED_SYSTEM_CHECKS | [] |
STATICFILES_DIRS | ['/home/tia/code/resources/'] |
STATICFILES_FINDERS | [u'django.contrib.staticfiles.finders.FileSystemFinder', u'django.contrib.staticfiles.finders.AppDirectoriesFinder'] |
STATICFILES_STORAGE | u'django.contrib.staticfiles.storage.StaticFilesStorage' |
STATIC_ROOT | '/home/tia/code/static/' |
STATIC_URL | '/static/' |
TEMPLATES | [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], '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 | u'django.test.runner.DiscoverRunner' |
THOUSAND_SEPARATOR | u',' |
TIME_FORMAT | u'P' |
TIME_INPUT_FORMATS | [u'%H:%M:%S', u'%H:%M:%S.%f', u'%H:%M'] |
TIME_ZONE | 'UTC' |
USE_ETAGS | False |
USE_I18N | True |
USE_L10N | True |
USE_THOUSAND_SEPARATOR | False |
USE_TZ | True |
USE_X_FORWARDED_HOST | False |
USE_X_FORWARDED_PORT | False |
WSGI_APPLICATION | 'TIA.wsgi.application' |
X_FRAME_OPTIONS | u'SAMEORIGIN' |
YEAR_MONTH_FORMAT | u'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.