amazon web services - Django debug toolbar crashes when deployed on AWS Elastic Beanstalk -
i running django app on aws elastic beanstalk django debug toolbar causing following error:
traceback (most recent call last): file "/opt/python/run/venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 235, in get_response response = middleware_method(request, response) file "/opt/python/run/venv/lib/python3.4/site-packages/debug_toolbar/middleware.py", line 123, in process_response response.content = insert_before.join(bits) file "/opt/python/run/venv/lib/python3.4/site-packages/django/http/response.py", line 315, in content value = self.make_bytes(value) file "/opt/python/run/venv/lib/python3.4/site-packages/django/http/response.py", line 235, in make_bytes return bytes(value.encode(self.charset)) unicodeencodeerror: 'utf-8' codec can't encode character '\\udcc3' in position 142917: surrogates not allowed
i did not have problem locally or when running django app on aws ec2 instance setup nginx , gunicorn myself. elastic beanstalk? maybe it's apache?
some details configuration:
versions
same locally on aws ebs
python 3.4.3
django 1.9.7
django toolbar 1.5
django settings
the following pieces of django settings activate toolbar
installed_apps = [ 'compare.apps.compareconfig', 'search.apps.searchconfig', 'profile.apps.profileconfig', 'common.apps.commonconfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_toolbar', ]
(i tried moving django_toolbar
further in list of installed apps didn't help)
middleware_classes = [ 'debug_toolbar.middleware.debugtoolbarmiddleware', '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', ] debug_toolbar_patch_settings = false def custom_show_toolbar(request): return true # show toolbar, example purposes only. debug_toolbar_config = { 'show_toolbar_callback': custom_show_toolbar, } language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true
and in root url conf file have
urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls))]
there other (can't find link now) mentioned adding utf-8
1 of language or use_***
parameters tried , didn't - perhaps didn't correctly also.
i love django debug toolbar, appreciate being able resolve this.
any ideas?
thanks!
Comments
Post a Comment