Skip to content Skip to sidebar Skip to footer

Templates Django (does Not Exist At/)

I'm trying to use the Django templates but i cant even display a simple html line i don't understand why... I searched to resolve it but after many test, the problem remains. This

Solution 1:

TEMPLATE_DIRS setting is deprecated in django 1.8. You should use the TEMPLATES instead.

The TEMPLATES variable is exists in the default settings.py file so find it and alter the 'DIRS' key:

TEMPLATES = [
    {
        ...
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        ...
    },
]

Solution 2:

P.S: Please edit your question instead of adding an answer to your question with a question :P

Coming to the error,

From your directory structure, you have two template directories, one in the main project and other in the polls app at mysite/polls/mysite/. Django is looking for templates in the project templates i.e.,

/home/florian/Documents/mysite/templates/mysite/bap2pmonitoring.html

but you have your template in

/home/florian/Documents/mysite/polls/templates/mysite/bap2pmonitoring.html

Put your templates in the main project template directory and it should work.

Solution 3:

It has a typo with the closing bracket. so the syntax error

use this

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

Solution 4:

you are missing to add your app in

INSTALLED_APPS = [ 'mysite', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ]

in settings.py.

Post a Comment for "Templates Django (does Not Exist At/)"