python - makemessages "should be run from the Django Git tree or your project or app tree"上的 Django 错误

标签 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 就在一天前,还有 mysitedjango 有一个包含 .po 文件的 locale 文件夹。

目录结构;

- 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,真的。

关于python - makemessages "should be run from the Django Git tree or your project or app tree"上的 Django 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21882785/

相关文章:

python /PIL : Create and save image from data uri

python - 在 Django Admin 中保留过滤器

python - 使用 Python 的 datetime 模块,我可以获得 UTC-11 当前所在的年份吗?

git - 错误 : cannot lock ref.。 'refs/tags' 存在;无法创建“引用/标签/

git - 当我的本地存储库中只有项目的一个子目录时,是否可以推送 Git?

python - 过滤行将结果保存在新列中

python - 无法使用日期作为字符串来切片 Pandas 数据框(以日期为键)

django - 内存数据库django中的Postgresql

Git:使用共享本地存储进行克隆(使用硬链接(hard link))

python - django - 使用不同的基本模板渲染任何网址