python - django unsupported locale setting on Mac OS X -


i've been developing application using django past year. application written in debian environment, development , testing entirely done in debain machine.

recently, decided move application local mac os x based laptop. using port's did virtual environment , pulled project github. when try runserver, getting "unsupported locale setting" exception.

my application uses locale heavily, noticed though language setting in machine set en_us.utf-8 while on debian machine en_us.utf8. don't know if dash reason why failing though.

my application using django-localeurl creating language code url schema i10n , i18n.

below exception getting

environment:   request method: request url: http://127.0.0.1:8000/en/  django version: 1.3.1 python version: 2.7.1 installed applications: ['localeurl',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.sites',  'django.contrib.messages',  'django.contrib.staticfiles',  'django.contrib.humanize',  'django.contrib.comments',  'libraries.plugins.piston',  'nani',  'haystack',  'compressor',  'libraries.plugins.social_auth',  'registration',  'djcelery',  'django.contrib.markup',  'south',  'libraries.plugins.storages',  'libraries.plugins.django_messages',  'merlin',  'seacucumber',  'timezones',  'treebeard',  'apps.core',  'apps.core.mediastore',  'apps.core.accounts',  'apps.core.mazvars',  'apps.core.mazguard',  'apps.core.system',  'apps.core.sponsorship',  'apps.portal.default',  'apps.portal.support',  'apps.portal.pages',  'apps.portal.blog',  'apps.portal.developer',  'apps.listing',  'apps.listing.postfix',  'apps.listing.category',  'apps.listing.post',  'apps.listing.home',  'apps.listing.shoutout',  'apps.listing.taggables',  'apps.listing.comment',  'apps.listing.badge',  'apps.listing.geo',  'apps.listing.reputation',  'apps.mzn.shorturl',  'grappelli.dashboard',  'grappelli',  'django.contrib.admin',  'django.contrib.admindocs',  'debug_toolbar'] installed middleware: ('localeurl.middleware.localeurlmiddleware',  'django.middleware.common.commonmiddleware',  'django.contrib.sessions.middleware.sessionmiddleware',  'django.middleware.csrf.csrfviewmiddleware',  'django.contrib.auth.middleware.authenticationmiddleware',  'django.contrib.messages.middleware.messagemiddleware',  'apps.core.middleware.fallbacklocalemiddleware',  'apps.core.accounts.middleware.loggingmiddleware',  'apps.core.accounts.middleware.completeemail',  'apps.core.accounts.middleware.setref',  'apps.core.accounts.middleware.followuser',  'apps.core.accounts.middleware.unfollowuser',  'apps.core.accounts.middleware.fraudlocked',  'apps.core.middleware.defaultadminlocalemiddleware',  'apps.core.middleware.defaultsitemiddleware',  'debug_toolbar.middleware.debugtoolbarmiddleware')   traceback: file "/users/mo/projects/pythonic/mazban/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response   111.                         response = callback(request, *callback_args, **callback_kwargs) file "/users/mo/projects/pythonic/mazban/mazban/apps/listing/home/views.py" in home   23.     cal = render_event_calendar_widget(language_code=request.language_code) file "/users/mo/projects/pythonic/mazban/mazban/apps/listing/post/event_views.py" in render_event_calendar_widget   115.     return cal.render() file "/users/mo/projects/pythonic/mazban/mazban/apps/core/utils.py" in render   81.             [day day in cal.formatweekheader(self.wh).split(' ')] file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/calendar.py" in formatweekheader   297.         return ' '.join(self.formatweekday(i, width) in self.iterweekdays()) file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/calendar.py" in <genexpr>   297.         return ' '.join(self.formatweekday(i, width) in self.iterweekdays()) file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/calendar.py" in formatweekday   511.         timeencoding(self.locale) encoding: file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/calendar.py" in __enter__   490.         _locale.setlocale(_locale.lc_time, self.locale) file "/users/mo/projects/pythonic/mazban/lib/python2.7/locale.py" in setlocale   531.     return _setlocale(category, locale)  exception type: error @ / exception value: unsupported locale setting 

any idea's causing this?

update:

when logged in terminal , wrote "locale" got below

(mazban)mohammed-mughrabis-macbook-pro:mazban mo$ locale lang="en_us.utf-8" lc_collate="en_us.utf-8" lc_ctype="en_us.utf-8" lc_messages="en_us.utf-8" lc_monetary="en_us.utf-8" lc_numeric="en_us.utf-8" lc_time="en_us.utf-8" lc_all= 

where in code set it? works me, since linux , osx machines vary , use code on both, wrote exception block:

try:     import locale     locale.setlocale(locale.lc_all, 'en_us.utf8') except exception:     try:         locale.setlocale(locale.lc_all, 'en_us.utf-8')     except exception e:         messages.error(request, 'an error occurred: {0}'.format(e)) 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -