所以,我正在使用Ant构建脚本通过manage.py
运行一些Django命令,我开始看到一个错误,但即使从python运行;
C:\Users\markw\work\proj\src>python manage.py makemessages --all
--ignore=unittests\* --no-wrap
CommandError: This script should be run from the Django Git tree or your project
or app tree. If you did indeed run it from the Git checkout or your project or
application, maybe you are just missing the conf/locale (in the django tree) or
locale (for project and application) directory? It is not created automatically,
you have to create it by hand if you want to enable i18n for your project or
application.
我的工作副本中唯一的变化与ANT有关并且让我更加困惑,以下ANT任务正确完成(以及只是从python运行它);
<!-- Compile the translations -->
<target name="compile.trans" depends="init.properties">
<exec executable="${deps.python}"
dir="src"
failonerror="true">
<arg value="manage.py"/>
<arg value="compilemessages"/>
</exec>
</target>
makemessages
有什么特别之处吗?我试图从src
开始运行,例如compilemessages
仅在前一天工作,也来自mysite
,django
和locale
有一个.po
文件夹使用- proj
-- django
-- conf
-- locale
-- mysite
-- locale
manage.py
个文件。
Dir结构;
LOCALE_PATHS = (
os.path.join(settings_central.BASE_PATH, 'templates', 'locale',),
os.path.join(settings_central.BASE_PATH, 'mysite', 'locale',),
os.path.join(settings_central.BASE_PATH, 'django', 'locale',),
)
设置:
{{1}}
答案 0 :(得分:7)
您的项目布局略有不正确。您的项目locale
目录应该是proj/locale
而不是proj/mysite/locale
,真的。