I'm working on django-project, that gathers the information from files
and folders. The main idea of project is follow: settings.py contains
the path to folder, afterwards the specific django view will create
the tree of DB records with names of child folder and files of parent
directory. The functionality I have completed, all work very well upon
python server (python ... runserver).
Next, I configure the Apach + WSGI on production server Ubuntu Server
9.10 for hosting project. At now the show begins. During the tree
building UnicodeDecodeError exception was raised when the filename/
foldername contains ciryllic symbols. Exception details are following:
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
92. response = callback(request, *callback_args,
**callback_kwargs)
File "/path/to/project/apps/controllers/gallery_controller.py" in sync
43. GalleryRepository.sync_albums_with_file_system()
File "/path/to/project/apps/repositories/gallery_repository.py" in
sync_albums_with_file_system
148. sync_albums_with_file_system(album, syncDateValue,
childPath, overrideExistFiles)
File "/path/to/project/apps/repositories/gallery_repository.py" in
sync_albums_with_file_system
138. childPath = os.path.join(rootFolder, childUnicode)
File "/usr/lib/python2.6/posixpath.py" in join
70. path += '/' + b
Exception Type: UnicodeDecodeError at /gallery/sync/
Exception Value: ('ascii', '/1111 - \xd0\xba\xd0\xbe\xd0\xbf
\xd0\xb8\xd1\x8f', 8, 9, 'ordinal not in range(128)')
WSGI configuration file:
# coding=utf-8
import os, sys
apache_configuration = os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
sys.path.append('/usr/local/lib/python2.6/dist-packages/django/')
sys.path.append('/path/to/project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myportfolio.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Project details:
1. All *.py files saved with UTF-8 encoding and have the first line #
coding=utf-8
2. Project I have tested on Mac OS X, Windows XP, Ubuntu Server 9.10
(production server) upon python server (python ... runserver) - all
work very well.
The issue was reproduced when the project Apach + WSGI is hosting.
I will be grateful for any suggestions.
Thanks,
Viktor Burdeinyi
I'm working on django-project, that gathers the information from files
and folders. The main idea of project is follow: settings.py contains
the path to folder, afterwards the specific django view will create
the tree of DB records with names of child folder and files of parent
directory. The functionality I have completed, all work very well upon
python server (python ... runserver).
Next, I configure the Apach + WSGI on production server Ubuntu Server
9.10 for hosting project. At now the show begins. During the tree
building UnicodeDecodeError exception was raised when the filename/
foldername contains ciryllic symbols.
The issue was solved by setting export LANG="ru_RU.UTF-8" in /etc/
apache2/envvars
Viktor Burdeinyi
On 16 мар, 13:50, Karen Tracey <kmtra...@gmail.com> wrote: