Django Crispy Forms没有加载正确的templatepack

时间:2015-09-13 19:42:41

标签: django django-crispy-forms

---我在Ubuntu ---

我正在尝试设置Django Crispy表单并收到以下错误:

Exception Type: TemplateDoesNotExist
Exception Value:    
bootstrap3/layout/buttonholder.html

Settings.py模板设置

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {...............

模板加载器postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/schachte/Documents/School/cse360/CSE_360_Project/CSE360_Project/ipcms/ipcms/templates/bootstrap3/layout/buttonholder.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.7/dist-packages/Django-1.8.4-py2.7.egg/django/contrib/admin/templates/bootstrap3/layout/buttonholder.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/Django-1.8.4-py2.7.egg/django/contrib/auth/templates/bootstrap3/layout/buttonholder.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/crispy_forms/templates/bootstrap3/layout/buttonholder.html (File does not exist)

很明显,dir并不是它试图找到的,但我怎样才能让crispy表单找到正确的bootstrap目录?

2 个答案:

答案 0 :(得分:3)

legend.show不是Bootstrap模板包的一部分。据记载,情况并非如此。

请参阅this issue for discussion

最好的办法是使用ButtonHolder代替

答案 1 :(得分:0)

您目前在哪里保存静态内容。问题似乎是由于Django无法从引导程序中找到您的静态内容。