Image don't shown in Django LFS -
i've added image product, not shown in product preview. error message appears: "the request content cannot loaded. please try again later". web-page located in localhost, db in utf8_general_ci (mysql), django 1.8, python 2.7. when try open attachement (i've put image there), recieve error, traceback il below post: environment:
request method: request url: http://localhost:8000/media/files/book1.png django version: 1.8 python version: 2.7.6 installed applications: ('lfs_theme', 'compressor', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.staticfiles', 'django.contrib.sites', 'django.contrib.flatpages', 'django.contrib.redirects', 'django.contrib.sitemaps', 'django_countries', 'pagination', 'reviews', 'portlets', 'lfs.addresses', 'lfs.caching', 'lfs.cart', 'lfs.catalog', 'lfs.checkout', 'lfs.core', 'lfs.criteria', 'lfs.customer', 'lfs.customer_tax', 'lfs.discounts', 'lfs.export', 'lfs.gross_price', 'lfs.mail', 'lfs.manage', 'lfs.marketing', 'lfs.manufacturer', 'lfs.net_price', 'lfs.order', 'lfs.page', 'lfs.payment', 'lfs.portlet', 'lfs.search', 'lfs.shipping', 'lfs.supplier', 'lfs.tax', 'lfs.tests', 'lfs.utils', 'lfs.voucher', 'lfs_contact', 'lfs_order_numbers', 'localflavor', 'postal', 'paypal.standard.ipn', 'paypal.standard.pdt') installed middleware: ('django.middleware.csrf.csrfviewmiddleware', 'django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.redirects.middleware.redirectfallbackmiddleware', 'pagination.middleware.paginationmiddleware') traceback: file "/home/stp/Рабочий стол/lfs-installer/eggs/django-1.8-py2.7.egg/django/core/handlers/base.py" in get_response 132. response = wrapped_callback(request, *callback_args, **callback_kwargs) file "/home/stp/Рабочий стол/lfs-installer/eggs/django-1.8-py2.7.egg/django/views/static.py" in serve 54. fullpath = os.path.join(document_root, newpath) file "/usr/lib/python2.7/posixpath.py" in join 80. path += '/' + b exception type: unicodedecodeerror @ /media/files/book1.png exception value: 'ascii' codec can't decode byte 0xd0 in position 10: ordinal not in range(128)
your problem media root path contains non-ascii characters, such "Рабочий стол".
posible solutions:
- move project ascii-only (non-cyrillic in case) path
- use python3 instead 2, not have unicode problems
- change
media_root
setting unicode string, e.g.u'/home/stp/Рабочий стол/myproject/media/'
Comments
Post a Comment