关于makemessages的Django错误“应该从Django Git树或你的项目或应用程序树运行”

时间:2014-02-19 14:03:02

标签: python django git ant

所以,我正在使用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仅在前一天工作,也来自mysitedjangolocale有一个.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}}

1 个答案:

答案 0 :(得分:7)

您的项目布局略有不正确。您的项目locale目录应该是proj/locale而不是proj/mysite/locale,真的。