overhangio / tutor-ecommerce

Ecommerce plugin for Tutor
GNU Affero General Public License v3.0
17 stars 50 forks source link

Unable to set the language to Chinese #7

Closed HertZPY closed 4 years ago

HertZPY commented 4 years ago

Enter the 'tutor local quickstart' command in the terminal and 'zh-cn' in the default language of the platform. The following error occurs:

TIM图片20200326165322

regisb commented 4 years ago

This is not due to the language change. The problem is that the container is not running.

HertZPY commented 4 years ago

@regisb However, changing the language to en does not cause this problem

regisb commented 4 years ago

@HertZPY does the error still occur? Can you please identify what is this container? You can see this by running:

docker ps | grep 602cf # or whatever its id is

Then, please paste here the logs of this container:

docker logs putthecontaineridhere
regisb commented 4 years ago

I managed to reproduce the issue. This is caused by the fact that the discovery service does not support Chinese, as you can see with:

$ tutor local logs --tail=100 discovery
...
discovery_1         | django.core.exceptions.ImproperlyConfigured: The value for PARLER_LANGUAGES['defaults']['code'] ('zh-cn') does not exist in LANGUAGES
discovery_1         | [2020-04-14 14:29:39 +0000] [10] [INFO] Worker exiting (pid: 10)
discovery_1         | [2020-04-14 14:29:39 +0000] [9] [ERROR] Exception in worker process
discovery_1         | Traceback (most recent call last):
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
discovery_1         |     worker.init_process()
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process
discovery_1         |     self.load_wsgi()
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
discovery_1         |     self.wsgi = self.app.wsgi()
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
discovery_1         |     self.callable = self.load()
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
discovery_1         |     return self.load_wsgiapp()
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
discovery_1         |     return util.import_app(self.app_uri)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/gunicorn/util.py", line 357, in import_app
discovery_1         |     __import__(module)
discovery_1         |   File "/openedx/discovery/course_discovery/wsgi.py", line 20, in <module>
discovery_1         |     application = get_wsgi_application()  # pylint: disable=invalid-name
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
discovery_1         |     django.setup(set_prefix=False)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
discovery_1         |     apps.populate(settings.INSTALLED_APPS)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
discovery_1         |     app_config.import_models()
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/django/apps/config.py", line 202, in import_models
discovery_1         |     self.models_module = import_module(models_module_name)
discovery_1         |   File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
discovery_1         |     return _bootstrap._gcd_import(name[level:], package, level)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/parler/models.py", line 71, in <module>
discovery_1         |     from parler.cache import MISSING, _cache_translation, _cache_translation_needs_fallback, _delete_cached_translation, get_cached_translation, _delete_cached_translations, get_cached_translated_field
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/parler/cache.py", line 11, in <module>
discovery_1         |     from parler import appsettings
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/parler/appsettings.py", line 32, in <module>
discovery_1         |     PARLER_LANGUAGES = add_default_language_settings(PARLER_LANGUAGES)
discovery_1         |   File "/openedx/venv/lib/python3.5/site-packages/parler/utils/conf.py", line 72, in add_default_language_settings
discovery_1         |     raise ImproperlyConfigured("The value for {0}['defaults']['code'] ('{1}') does not exist in LANGUAGES".format(var_name, defaults['code']))
discovery_1         | django.core.exceptions.ImproperlyConfigured: The value for PARLER_LANGUAGES['defaults']['code'] ('zh-cn') does not exist in LANGUAGES
discovery_1         | [2020-04-14 14:29:39 +0000] [9] [INFO] Worker exiting (pid: 9)
discovery_1         | [2020-04-14 14:29:39 +0000] [6] [INFO] Shutting down: Master
discovery_1         | [2020-04-14 14:29:39 +0000] [6] [INFO] Reason: Worker failed to boot.

I'll work on a fix.

regisb commented 4 years ago

Thank you for your perseverance @HertZPY! This will be fixed in release v0.1.14, which will be published in a few minutes.