Open n8twj opened 4 years ago
I cloned the repository today and ran linux-bench-minimal.sh. Everything ran as expected until the very end when a Django error was presented.
`
global name 'codecs' is not defined
['.', '', '/home/linux-bench/django/venv/lib/python2.7', '/home/linux-bench/django/venv/lib/python2.7/plat-x86_64-linux-gnu', '/home/linux-bench/django/venv/lib/python2.7/lib-tk', '/home/linux-bench/django/venv/lib/python2.7/lib-old', '/home/linux-bench/django/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/linux-bench/django/venv/local/lib/python2.7/site-packages', '/home/linux-bench/django/venv/lib/python2.7/site-packages']
/home/linux-bench/django/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py
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 isinstance(callback, types.FunctionType): # FBV
view_name = callback.__name__
else: # CBV
NameError("global name 'codecs' is not defined",)
()
ResolverMatch(func=linuxbench.views.upload_file, args=(), kwargs={}, url_name=upload_file, app_names=[], namespaces=['linuxbench'])
False
<bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x7fe332f4a550>>
<django.core.handlers.wsgi.WSGIHandler object at 0x7fe334357c10>
<WSGIRequest: POST '/upload_file/'>
<function upload_file at 0x7fe332e8f7d0>
<RegexURLResolver 'mysite.urls' (None:None) ^/>
{}
None
'mysite.urls'
response = middleware_method(request, callback, callback_args, callback_kwargs)
if response:
/home/linux-bench/django/venv/local/lib/python2.7/site-packages/django/views/decorators/csrf.py
wrapped_view
"""
Marks a view function as being exempt from the CSRF view protection.
# We could just do view_func.csrf_exempt = True, but decorators
# are nicer if they don't have side-effects, so we return a new
# function.
def wrapped_view(*args, **kwargs):
return view_func(*args, **kwargs)
wrapped_view.csrf_exempt = True
return wraps(view_func, assigned=available_attrs(view_func))(wrapped_view)
(<WSGIRequest: POST '/upload_file/'>,)
<function upload_file at 0x7fe332e8f758>
./linuxbench/views.py
upload_file
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
# lets save this file.
filename = str(request.FILES['file']) # received file name
print "uploading " + filename
utf8_file = codecs.EncodedFile(request.FILES['file'],"utf-8")
filename = saveFileToDisk(utf8_file,utf8_file.readlines())
context = parse_data(filename,utf8_file.readlines())
return HttpResponseRedirect('/')
else:
form = UploadFileForm()
return render_to_response('upload.html', {'form': form}, RequestContext(request))
<UploadFileForm bound=True, valid=True, fields=(file)>
'linux-bench12.19_qss-freeswitch_2019_1204_145129.log'
No GET data
u'Upload'
<InMemoryUploadedFile: linux-bench12.19_qss-freeswitch_2019_1204_145129.log (application/octet-stream)>
No cookie data
True
u''
'POST'
u'/upload_file/'
'HTTP/1.1'
''
'http'
'137198'
'curl/7.52.1'
'linux-bench.com'
'167.99.0.54'
'80'
'linux-bench'
'/usr/share/nginx/html'
<uwsgi._Input object at 0x7fe332e273c0>
'100-continue'
'multipart/form-data; boundary=------------------------366df70cc1e5cddd'
'/upload_file/'
'*/*'
(1, 0)
<open file 'wsgi_errors', mode 'w' at 0x7fe333046f60>
'43034'
'2.0.10'
mysite.settings
'en-us'
[]
'/home/linux-bench/django/mysite'
'utf-8'
'django.contrib.sessions.serializers.JSONSerializer'
'/Users/swillett/Desktop/django/mysite/mysite/static/'
'django.contrib.messages.storage.fallback.FallbackStorage'
'[Django] '
'root@localhost'
0
['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
'default'
'sessionid'
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
{'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': '/home/linux-bench/django/mysite/db.sqlite3', 'OPTIONS': {}, 'PASSWORD': u'********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}}
u'********************'
['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
'text/html'
'F Y'
'django.contrib.staticfiles.storage.StaticFilesStorage'
{'default': {'BACKEND': 'django.core.cache.backends.db.DatabaseCache', 'LOCATION': 'my_cache_table'}}
'/'
['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', 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware']
','
'django_language'
'logging.config.dictConfig'
['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader']
'mysite.wsgi.application'
'SAMEORIGIN'
'csrftoken'
'HTTP_X_CSRFTOKEN'
'django.core.signing.TimestampSigner'
'django.core.files.storage.FileSystemStorage'
['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'linuxbench', 'bootstrap3']
[('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')]
[('images', 'mysite/static/images/'), ('scripts', 'mysite/static/scripts/')]
31449600
'F j'
'/accounts/login/'
'P'
'auth.User'
['%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']
['django.contrib.auth.backends.ModelBackend']
'django.contrib.sessions.backends.db'
'django.views.csrf.csrf_failure'
'/accounts/profile/'
'.'
'/accounts/logout/'
'localhost'
'N j, Y'
'django.views.debug.SafeExceptionReporterFilter'
'webmaster@localhost'
'N j, Y, P'
'm/d/Y'
[{'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']}}]
'django.test.runner.DiscoverRunner'
'UTC'
2621440
'django.core.mail.backends.smtp.EmailBackend'
['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']
1209600
'mysite.settings'
['he', 'ar', 'fa', 'ur']
'/static/'
25
'm/d/Y P'
600
['%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']
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.
DEBUG = True
I cloned the repository today and ran linux-bench-minimal.sh. Everything ran as expected until the very end when a Django error was presented.
`
NameError at /upload_file/
Traceback Switch to copy-and-paste view
/home/linux-bench/django/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py
inget_response
/home/linux-bench/django/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py
inget_response
/home/linux-bench/django/venv/local/lib/python2.7/site-packages/django/views/decorators/csrf.py
inwrapped_view
./linuxbench/views.py
inupload_file
Request information
GET
No GET data
POST
FILES
COOKIES
No cookie data
META
Settings
Using settings module
mysite.settings
You're seeing this error because you have
DEBUG = True
in your Django settings file. Change that toFalse
, and Django will display a standard page generated by the handler for this status code.