Django.template.loaders.文件系统.Loader不适用于Django应用程序

2024-04-24 18:57:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我在数字海洋上有2个VP在服务一个应用程序,而且我的域名对第一个有效。我需要建立一个舞台环境,导航我得到:

TemplateDoesNotExist at /accounts/login/
accounts/login.html

无法登录。我的项目可见:

^{pr2}$

但模板的默认文件系统加载程序已损坏:

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/usr/lib/python2.7/dist-packages/django/contrib/admin/templates/accounts/login.html (File does not exist)
/usr/lib/python2.7/dist-packages/django/contrib/auth/templates/accounts/login.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/bootstrapform/templates/accounts/login.html (File does not exist)
/home/django/bookmarks_tracker/helpdesk/templates/accounts/login.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/crispy_forms/templates/accounts/login.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/django_extensions/templates/accounts/login.html (File does not exist)
/usr/local/lib/python2.7/dist-packages/mptt/templates/accounts/login.html (File does not exist)

但是,在设置.py公司名称:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, "templates"), os.path.join(BASE_DIR, "helpdesk/templates"),],
        'APP_DIRS': True,
        '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',
            ],
        },
    },
]

在我的工作VPS中,模板的结构是相同的,django版本也是相同的。是什么原因导致它在应用程序内部查看,而不是模板目录?谢谢你


Tags: djangolibpackagesusrdisthtmlcontextnot