Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
django未加载模板_Django_Django Templates - Fatal编程技术网

django未加载模板

django未加载模板,django,django-templates,Django,Django Templates,也许我遗漏了一些东西,但出于某种原因,django没有在正确的位置寻找模板。我已将contact/templates文件夹包含在TEMPLATE目录中,并将应用程序包含在已安装的应用程序中,但当我访问URL时,它仍会检查设置文件中列出的每个其他目录中的contact.html,并接受它所在的目录。我得到一个TemplateDoesNotExister错误。我是否可以使用pythonshell命令来诊断问题 TEMPLATE_DIRS = [ os.path.join(PACKAGE_RO

也许我遗漏了一些东西,但出于某种原因,django没有在正确的位置寻找模板。我已将contact/templates文件夹包含在TEMPLATE目录中,并将应用程序包含在已安装的应用程序中,但当我访问URL时,它仍会检查设置文件中列出的每个其他目录中的contact.html,并接受它所在的目录。我得到一个TemplateDoesNotExister错误。我是否可以使用pythonshell命令来诊断问题

TEMPLATE_DIRS = [
    os.path.join(PACKAGE_ROOT, "templates"),
    '/mysite/contact/templates', #does not search this one
    '/mysite/liquor/templates', #searches this one
    '/mysite/store/templates', #searches this one
    '/mysite/order/templates', #searches this one
]

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.sites",
    "django.contrib.messages",
    "django.contrib.staticfiles",

    # theme
    "pinax_theme_bootstrap",
    "django_forms_bootstrap",

    # external
    "account",
    "metron",
    "eventlog",
    "paypal.standard.ipn",
    "djangojs",
    "django_tables2",
    "django_filters",

    # project
    "contact",
    "mysite",
    "liquor",
    "store",
    "order",
]
确保你有

django.template.loaders.filesystem.Loader

在您的
模板\u加载程序
设置中列出

否则,请安装
django extensions
,并使用
find_template
管理命令调试问题

例如,如果您试图使用index.html

python manage.py find_template index.html
确保你有

django.template.loaders.filesystem.Loader

在您的
模板\u加载程序
设置中列出

否则,请安装
django extensions
,并使用
find_template
管理命令调试问题

例如,如果您试图使用index.html

python manage.py find_template index.html

模板加载程序已列出,我尝试使用django扩展,它指向html文件的位置。但是,该站点仍然不会在该文件夹中查找它。TEMPLATE_LOADERS已列出,我尝试使用django扩展,它指向html文件的位置。但是,网站仍然不会在该文件夹中查找它。您已在设置中添加了
联系人/模板
,但有疑问的是,您说模板位于
联系人/模板
(不带“s”)。这是打字错误还是你真正的问题?@Rohan,不,这只是一个打字错误。我会编辑它。您已在设置中添加了
联系人/模板
,但有问题的是,您说的模板位于
联系人/模板
(不带“s”)。这是打字错误还是你真正的问题?@Rohan,不,这只是一个打字错误。我会编辑它。