因此,我正在使用一个Ant构建脚本来运行一些Django命令,manage.py
并且开始看到错误,但是即使是从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
的文件。
dir结构;
- proj
-- django
-- conf
-- locale
-- mysite
-- locale
manage.py
设置:
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',),
)
您的项目布局略有不正确。您的项目locale
目录应该是proj/locale
,不是proj/mysite/locale
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句