Open xc3seziu opened 6 years ago
That issue actually came up for me (on a fresh install on a brand-spanking-new Ubuntu 18.04 system). It seems to be a locale issue. Please see:
https://github.com/stephenmcd/cartridge/issues/4
Since my locale is "LANG=C.UTF-8", it seems to have triggered this problem. I got around this by doing SHOP_CURRENCY_LOCALE = 'en_US.UTF-8' in local_settings.py
Never the less, it sounds like something that should be sorted in the installation process.
I'm getting the same issue on fresh installation on Ubuntu 20.04 Locals are set to C by default on my server:
$ locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC=C.UTF-8
LC_TIME=C.UTF-8
LC_COLLATE="C.UTF-8"
LC_MONETARY=C.UTF-8
LC_MESSAGES="C.UTF-8"
LC_PAPER=C.UTF-8
LC_NAME=C.UTF-8
LC_ADDRESS=C.UTF-8
LC_TELEPHONE=C.UTF-8
LC_MEASUREMENT=C.UTF-8
LC_IDENTIFICATION=C.UTF-8
LC_ALL=
When I tried to generate locales and set the currency locale to en_US.UTF-8
SHOP_CURRENCY_LOCALE = 'en_US.UTF-8'
I got:
Invalid currency locale specified for SHOP_CURRENCY_LOCALE: 'en_USA.UTF-8'
$ python manage.py createdb --noinput --nodata
Traceback (most recent call last):
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/cartridge/shop/utils.py", line 99, in set_locale
if setlocale(LC_MONETARY, currency_locale) == "C":
File "/usr/lib/python3.8/locale.py", line 608, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/cartridge/shop/models.py", line 36, in <module>
class Priced(models.Model):
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/cartridge/shop/models.py", line 42, in Priced
unit_price = fields.MoneyField(_("Unit price"))
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/cartridge/shop/fields.py", line 46, in __init__
set_locale()
File "/home/user/.local/share/virtualenvs/website-uhzATchw/lib/python3.8/site-packages/cartridge/shop/utils.py", line 109, in set_locale
raise ImproperlyConfigured(msg % currency_locale)
django.core.exceptions.ImproperlyConfigured: Invalid currency locale specified for SHOP_CURRENCY_LOCALE: 'en_USA.UTF-8'. You'll need to set the locale for your system, or configure the SHOP_CURRENCY_LOCALE setting in your settings module.
For some reason my system had locale as
en_US.utf8
I've played with multiple django based software installation but never seen this type of error. I guess it's something that should be handled by the installation process as @peterkmurphy suggested.
If you want to use a locale in Cartridge it has to be installed in the system.
Don’t know what happened here but the locale en_USA.utf8
doesn't exists. Correct is en_US.utf8
.
I didn't want to specify any local, I mean I just want it to get Cartridge to run but the default configurations didn't work for me.
As I recall locale C doesn't work for some reason. But I need to research for the exact issue.
Python 3.6.5 Django 1.11.15 Mezzanine 4.3.0 Cartridge 0.13.0
I've seen this issues on other platforms but haven't been able to find the issue on OpenBSD. Local (LC_ALL) is set to en_US.UTF-8 (this was listed as a possible culprit in some situations).
Here's the full error when I run './manage.py createdb':
Please advise.