我最近剥离了一个旧项目并尝试安装其应用程序(有效)并安装了django-helpdesk / bootstrap_forms。但是django既没有找到帮助台模板,也没有找到bootstrapform模板。我的settings.py看起来像:
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'key'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts',
'index',
'taggit',
'helpdesk',
'bootstrapform',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
HELPDESK_PATH = "/home/cchilders/.local/virtualenv/new_bookmarks/lib/python2.7/site-packages/helpdesk/templates",
BOOSTRAPFORM_PATH = "/home/cchilders/.local/virtualenv/new_bookmarks/lib/python2.7/site-packages/bootstrapform/templates"
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates"),
"/home/cchilders/.local/virtualenv/new_bookmarks/lib/python2.7/site-packages/helpdesk/templates",
"/home/cchilders/.local/virtualenv/new_bookmarks/lib/python2.7/site-packages/bootstrapform/templates",],
'APP_DIRS': False,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
STATIC_ROOT = '/home/cchilders/django_practice/new_bookmarks/static'
STATIC_URL = '/static/'
我现在没有问题,但是为什么我必须手动执行HELPDESK_PATH和BOOSTRAPFORM_PATH非常困惑。我最后一次旋转它,安装应用程序就完成了盒子,使用相同的TEMPLATE配置。我安装了这些:
Django==1.8.3
argparse==1.2.1
betterpath==0.2.2
django-bootstrap-form==3.2
django-extensions==1.5.5
django-helpdesk==0.1.16
django-markdown-deux==1.0.5
django-mptt==0.7.4
django-taggit==0.16.2
email-reply-parser==0.3.0
ipython==3.2.1
l==0.3.1
lxml==3.4.4
markdown2==2.3.0
pytz==2015.4
requests==2.7.0
simplejson==3.8.0
six==1.9.0
vcversioner==2.14.0.0
wsgiref==0.1.2
zope.interface==4.1.2
我正在运行VE(就像我找到模板时那样)并且包是预期的地方:
~/.local/virtualenv/new_bookmarks/lib/python2.7/site-packages/bootstrapform/templates
关闭新网址时,我会回复'DIRS': [os.path.join(BASE_DIR, "templates"), ],
TemplateDoesNotExist at /helpdesk/
helpdesk/public_homepage.html
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/cchilders/django_practice/new_bookmarks/templates/helpdesk/public_homepage.html (File does not exist)
我不明白为什么它不检查通常的地方。我的VE工作,如果我deactive它我不能runserver由于缺少像'taggit'这样的包。什么通常导致django忽略网站包而不寻找BASE_DIR /模板之外的模板?谢谢