简体   繁体   中英

Why Heroku can't find my Django templates?

I deployed my project on Heroku. But it can't find my templates(Source doesn't exist):

在此处输入图像描述

My project architecture:

在此处输入图像描述

settings.py:

from pathlib import Path
import sys
import os

BASE_DIR = Path(__file__).resolve().parent.parent

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

UPDATE : All templates from the Account app load with this extending

The problem is solved. There was extra whitespace, like {% extends 'base/base.html ' %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM