gpt4 book ai didi

python - django-admin.py makemessages 失败

转载 作者:行者123 更新时间:2023-11-28 17:39:25 33 4
gpt4 key购买 nike

我用 django-admin.py makemessages -a 创建了语言文件

稍作开发之后,所有创建 *.po 文件的尝试都失败了:

django-admin.py makemessages  -v 3 -a
examining files with the extensions: .html and .txt
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 533, in handle
return self.handle_noargs(**options)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/makemessages.py", line 283, in handle_noargs
potfiles = self.build_potfiles()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/makemessages.py", line 299, in build_potfiles
file_list = self.find_files(".")
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/makemessages.py", line 358, in find_files
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT)]
File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/makemessages.py", line 358, in <listcomp>
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT)]
File "/usr/lib/python3.4/posixpath.py", line 335, in normpath
initial_slashes = path.startswith(sep)
AttributeError: 'NoneType' object has no attribute 'startswith'

我尝试了几个文件扩展名和 -ignore 模式。你有什么提示吗?

最佳答案

我从 django 1.7 开始就遇到了同样的问题。我使用 manage.py 代替 django-admin.py 来生成消息,不包括环境文件夹:

python manage.py makemessages --locale=en --ignore=venv/*

关于python - django-admin.py makemessages 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26744380/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com