Re: How/where to call setlocale

2014-09-19 Thread uvetter
Dear Jay, glad that it works now. I got myself confused about terms such as language name and locale name. Setting the locale via locale.setlocale does indeed have no influence on the Django settings. I knew that but I misunderstood you. I set locale.setlocale in the example because I wanted to

Re: How/where to call setlocale

2014-09-19 Thread James Hargreaves
Thanks again for your reply Ulrich. I finally figured out the problem :) Towards the bottom of my settings.py I had mistakenly overwritten the LANGUAGE_CODE as follows: LANGUAGE_CODE = 'en' Django must determine the locale internally based on the LANGUAGE_CODE specified. Needless to say

Re: How/where to call setlocale

2014-09-18 Thread James Hargreaves
Hi Ulrich et al, Thanks again for your help. I'm having issues with your solution. It works when making a literal call to locale but Django is not using the correct locale for some reason. I added this to my application.wsgi: import locale locale.setlocale(locale.LC_ALL,

Re: How/where to call setlocale

2014-09-17 Thread James Hargreaves
Thanks Ulrich. No I think I've misread the documentation with regards it affecting the whole environment rather than the program. I'll try your solution myself but it looks like it will work, thanks! Jay On Tuesday, September 16, 2014, uvetter wrote: > Dear Jay,

Re: How/where to call setlocale

2014-09-16 Thread uvetter
Dear Jay, I just tried to following in my wsgi.py file: import os import sys import site import locale site.addsitedir('/mypath/lib/python3.3/site-packages') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings") os.environ['HTTPS'] = "on" sys.path.append('/mypath/test')

Re: How/where to call setlocale

2014-09-16 Thread James Hargreaves
Thanks for your reply Ulrich. If I set the locale in WSGI would that persist for all connections? If so that sounds like the best option. Thanks Jay On Tuesday, September 16, 2014, wrote: > Hi, > I ran into a similar problem yesterday while programming a web shop

Re: How/where to call setlocale

2014-09-16 Thread rettevhcirlu
Hi, I ran into a similar problem yesterday while programming a web shop with Django (Version 1.6, Python version 3.3) where language switching should immediately have an effect on the way prices, etc. are displayed (doing so by a in the template and redirecting back to the page where it was

How/where to call setlocale

2014-09-16 Thread James Hargreaves
Hello, I am running Django/python on Ubuntu. I am finding that my locale is not setup correctly. Running locale from the command line shows this: LANG=en_GB.UTF-8 LANGUAGE=en_GB:en LC_CTYPE="en_GB.UTF-8" LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8"