2013-10-13 45 views
1

應用程序名稱是邀請。我希望它在Django在錯誤的目錄中尋找應用程序的模板

$PROJECT/invitations/templates/invite_many.html 

看,而是它看起來在

$PROJECT/invitations/templates/invitations/invite_many.html 

這裏有潛在的相關設置:

import os.path 

ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) 
PROJECT_NAME = os.path.basename(ROOT_DIR) 

def ABS_PATH(*args): 
    return os.path.join(ROOT_DIR, *args) 

def ENV_SETTING(key, default): 
    import os 
    return os.environ.get(key, default) 

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader', 
    'django.template.loaders.app_directories.Loader', 
    # 'django.template.loaders.eggs.Loader', 
) 

TEMPLATE_DIRS = (
    ABS_PATH('templates'), 
) 
+0

你在代碼中使用模板的地方?如果您將模板路徑設置爲'invitations/invite_many.html',則應該只執行'invite_many.html' –

+0

是的。非常愚蠢的錯誤 - 只是習慣於將模板路徑寫爲app_name/file.html。繼續前進並回答,以便我可以將其標記爲正確。 – KrisF

回答

3

我想你給模板路徑invitations/invite_many.html而你只應該給invite_many.html

相關問題