makemessages上的Django错误“应该从Django Git树或您的项目或应用程序树中运行”

2024-06-06 12:41:38 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我正在使用一个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运行它)

^{pr2}$

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',),
)

Tags: orthepathdjangopyprojectyoutree