0

按照http://read-the-docs.readthedocs.io/en/latest/install.html中的指南在本地安装 readthedocs失败。我正在尝试将它安装在 Mac Pro OSX El Capitan 10.11.15 上。

当我尝试访问 localhosts:8000 时,它会返回消息A server error occurred. Please contact the administrator.

终端输出:

Performing system checks...

System check identified no issues (1 silenced).
July 21, 2016 - 15:04:28
Django version 1.8.3, using settings 'readthedocs.settings.dev'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
    self.load_middleware()
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/core/handlers/base.py", line 52, in load_middleware
    mw_instance = mw_class()
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/middleware/locale.py", line 24, in __init__
    for url_pattern in get_resolver(None).url_patterns:
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/core/urlresolvers.py", line 402, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/core/urlresolvers.py", line 396, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/Lex/rtd/checkouts/readthedocs.org/readthedocs/urls.py", line 54, in <module>
    url(r'^api/v2/', include('readthedocs.restapi.urls')),
  File "/Users/Lex/rtd/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 33, in include
    urlconf_module = import_module(urlconf_module)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/Lex/rtd/checkouts/readthedocs.org/readthedocs/restapi/urls.py", line 10, in <module>
    from readthedocs.comments.views import CommentViewSet
  File "/Users/Lex/rtd/checkouts/readthedocs.org/readthedocs/comments/views.py", line 22, in <module>
    from sphinx.websupport import WebSupport
  File "/Users/Lex/rtd/lib/python2.7/site-packages/sphinx/websupport/__init__.py", line 18, in <module>
    from docutils.core import publish_parts
  File "/Users/Lex/rtd/lib/python2.7/site-packages/docutils/core.py", line 20, in <module>
    from docutils import frontend, io, utils, readers, writers
  File "/Users/Lex/rtd/lib/python2.7/site-packages/docutils/frontend.py", line 41, in <module>
    import docutils.utils
  File "/Users/Lex/rtd/lib/python2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
    import docutils.io
  File "/Users/Lex/rtd/lib/python2.7/site-packages/docutils/io.py", line 18, in <module>
    from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
  File "/Users/Lex/rtd/lib/python2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
    locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
  File "/Users/Lex/rtd/lib/python2.7/locale.py", line 562, in getlocale
    return _parse_localename(localename)
  File "/Users/Lex/rtd/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
[21/Jul/2016 15:04:37]"GET / HTTP/1.1" 500 59

有谁熟悉这个问题?

4

1 回答 1

0

通过以下方式修复了问题:

导出 LANG="en_US.UTF-8" 导出 LC_ALL="en_US.UTF-8"

于 2016-07-21T20:32:26.377 回答