简体   繁体   中英

what should i write in the settings.py to import my Template

I have deployed my project on pythonanywhere and there i am getting an error that template does not exist

在此处输入图像描述

It's working properly on local host

File directory

在此处输入图像描述

settings.py

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

Can someone tell what should i add my template DIRS

Try to put this into DIRS

'DIRS': [os.path.join(BASE_DIR, 'Templates')],

after that you can get your html files like 'Main/test.html'

And yeah it's better to put names in lowercase

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