Я пытался это исправить, но я не могу этого понять. Я использую Python 3.7.2, Django 2.1.11 и Django -weasyprint 0.5.4. Я читал другие вопросы, подобные этим, но ни один из них не подходит к моей проблеме. Я попытался исправить проблему ошибки значения с помощью экспорта LC_ALL = en_US.UTF-8 export LANG = en_US.UTF-8, но они также, похоже, не работают.
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x102980b70>
Traceback (most recent call last):
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/core/management/base.py", line 379, in check
include_deployment_checks=include_deployment_checks,
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/core/management/base.py", line 366, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/core/checks/registry.py", line 71, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 533, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 526, in urlconf_module
return import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/nirwan/Desktop/CASS-Degrees-Code/cassdegrees/cassdegrees/urls.py", line 22, in <module>
path('', include('ui.urls')),
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/nirwan/Desktop/CASS-Degrees-Code/cassdegrees/ui/urls.py", line 27, in <module>
from .views.pdf import *
File "/Users/nirwan/Desktop/CASS-Degrees-Code/cassdegrees/ui/views/pdf.py", line 5, in <module>
from django_weasyprint import WeasyTemplateResponse
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django_weasyprint/__init__.py", line 1, in <module>
from .views import WeasyTemplateResponseMixin, WeasyTemplateView, WeasyTemplateResponse
File "/Users/nirwan/Desktop/CASS-Degrees-Code/venv/lib/python3.7/site-packages/django_weasyprint/views.py", line 4, in <module>
import weasyprint
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/__init__.py", line 443, in <module>
from .document import Document, Page # noqa isort:skip
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/document.py", line 23, in <module>
from .draw import draw_page, stacked
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/draw.py", line 19, in <module>
from .images import SVGImage
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/images.py", line 17, in <module>
import cairosvg.parser
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairosvg/__init__.py", line 42, in <module>
from . import surface # noqa isort:skip
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairosvg/surface.py", line 28, in <module>
from .defs import (
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairosvg/defs.py", line 24, in <module>
from .bounding_box import calculate_bounding_box, is_non_empty_bounding_box
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairosvg/bounding_box.py", line 26, in <module>
from .features import match_features
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairosvg/features.py", line 25, in <module>
LOCALE = locale.getdefaultlocale()[0] or ''
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/locale.py", line 568, in getdefaultlocale
return _parse_localename(localename)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/locale.py", line 495, in _parse_localename
raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8