2014-02-19 15 views
7

因此,我正在使用Ant構建腳本通過manage.py運行一些Django命令,並且我開始看到一個錯誤,但是甚至從python運行時;有關makemessages的Django錯誤應該從Django Git樹或您的項目或應用程序樹運行「

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任務完成正確的(以及剛剛從蟒蛇運行它);

<!-- 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有什麼特別的嗎?我試圖運行它從srccompilemessages工作一天前,也從mysite其中django有一個locale文件夾與文件。

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

什麼是'settings_central.BASE_PATH'等於? –

+0

@TigranSaluev我不能再說了,因爲這與我以前的工作有關。但是它確實解決了從src root開始的路徑。 –

回答

7

你的項目佈局稍有不正確。您的項目locale目錄應該是proj/locale而不是proj/mysite/locale,確實如此。

相關問題