makemessages django-admin.py ล้มเหลว

ฉันได้สร้างไฟล์ภาษาด้วย 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'

ฉันลองใช้นามสกุลไฟล์หลายไฟล์แล้ว -ละเว้นรูปแบบ คุณมีคำแนะนำบ้างไหม?


person Lioman    schedule 04.11.2014    source แหล่งที่มา
comment
คุณได้ตรวจสอบเพื่อให้แน่ใจว่า settings.MEDIA_ROOT และ settings.STATIC_ROOT มีอยู่และถูกต้องหรือไม่   -  person schillingt    schedule 05.11.2014
comment
ฉันได้ลองตั้งค่าแบบนี้: STATIC_ROOT = ( os.path.join(BASE_DIR, 'static'), ) หรือด้วย '/var/www/projectroot/static'   -  person Lioman    schedule 05.11.2014
comment
โอเค มันแปลก: ฉันใช้ vagrant เพื่อการพัฒนาและเกิดข้อผิดพลาดที่อธิบายไว้ที่นั่น ในขณะที่คำสั่งอื่นๆ ทุกคำสั่งไม่ทำให้เกิดความล้มเหลว ฉันได้ลองบนเครื่องโฮสต์แล้วและทุกอย่างทำงานได้ตามปกติ   -  person Lioman    schedule 05.11.2014
comment
นั่นไม่ซ้ำกัน มันเป็นคำถามเดียวกัน!   -  person Lioman    schedule 18.11.2014


คำตอบ (2)


นี่เป็นเพราะ ข้อบกพร่อง ที่นำมาใช้ใน Django 1.7.1 คุณสามารถแก้ไขได้โดยอัปเดต Django ของคุณเป็นเวอร์ชันล่าสุดโดยใช้:

  pip install -U django

ป.ล. คุณสามารถดูคำถามและคำตอบที่เกี่ยวข้องกับ StackOverflow เกี่ยวกับเรื่องนี้ได้ที่นี่ และ ที่นี่

person Akyidrian    schedule 21.01.2015

ฉันมีปัญหาเดียวกันตั้งแต่ django 1.7 ฉันใช้ Manage.py เพื่อสร้างข้อความแทน django-admin.py ยกเว้นโฟลเดอร์สภาพแวดล้อม:

python manage.py makemessages --locale=en --ignore=venv/*
person iago1460    schedule 08.12.2014