Django Part 1 - TemplateDoesNotExist

I am at Django Fundamentals: 10-Using Templates. I followed everything that Mosh did, but for some reason, I am getting a TemplateDoesNotExist error. I tried Stackoverflow’s solutions, but it didn’t seem to help.

Below is the output of the error when I go to http://localhost:8000/playground/hello/ :

# TemplateDoesNotExist at /playground/hello/

hello.html

|Request Method:|GET|
| --- | --- |
|Request URL:|http://localhost:8000/playground/hello/|
|Django Version:|3.2.8|
|Exception Type:|TemplateDoesNotExist|
|Exception Value:|hello.html|
|Exception Location:|/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/template/loader.py, line 19, in get_template|
|Python Executable:|/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/bin/python3|
|Python Version:|3.10.0|
|Python Path:|['/Users/stevehon/pyprograms/storefront', '/Library/Frameworks/Python.framework/Versions/3.10/lib/python310.zip', '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10', '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload', '/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages']|
|Server time:|Thu, 14 Oct 2021 21:06:38 +0000|

## Template-loader postmortem

Django tried loading these templates, in this order:

Using engine `django` :

* `django.template.loaders.app_directories.Loader` : /Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/contrib/admin/templates/hello.html (Source does not exist)
* `django.template.loaders.app_directories.Loader` : /Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/contrib/auth/templates/hello.html (Source does not exist)

## Traceback [Switch to copy-and-paste view](http://localhost:8000/playground/hello/#)

* `/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/core/handlers/exception.py` , line 47, in inner

  47. response = get_response(request)

…

[▶ Local vars](http://localhost:8000/playground/hello/#)

* `/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/core/handlers/base.py` , line 181, in _get_response

  181. response = wrapped_callback(request, *callback_args, **callback_kwargs)

…

[▶ Local vars](http://localhost:8000/playground/hello/#)

* `/Users/stevehon/pyprograms/storefront/playground/views.py` , line 8, in say_hello

  8. return render(request, 'hello.html')

…

[▶ Local vars](http://localhost:8000/playground/hello/#)

* `/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/shortcuts.py` , line 19, in render

  19. content = loader.render_to_string(template_name, context, request, using=using)

…

[▶ Local vars](http://localhost:8000/playground/hello/#)

* `/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/template/loader.py` , line 61, in render_to_string

  61. template = get_template(template_name, using=using)

…

[▶ Local vars](http://localhost:8000/playground/hello/#)

* `/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/lib/python3.10/site-packages/django/template/loader.py` , line 19, in get_template

  19. raise TemplateDoesNotExist(template_name, chain=chain)

…

[▶ Local vars](http://localhost:8000/playground/hello/#)

## Request information

### USER

AnonymousUser

### GET

No GET data

### POST

No POST data

### FILES

No FILES data

### COOKIES

No cookie data

### META

Variable Value
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL 'true'
COLORTERM 'truecolor'
COMMAND_MODE 'unix2003'
CONTENT_LENGTH ''
CONTENT_TYPE 'text/plain'
DJANGO_SETTINGS_MODULE 'storefront.settings'
GATEWAY_INTERFACE 'CGI/1.1'
GIT_ASKPASS '********************'
HOME '/Users/stevehon'
HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING 'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE 'en-US,en;q=0.9'
HTTP_CACHE_CONTROL 'no-cache'
HTTP_CONNECTION 'keep-alive'
HTTP_DNT '1'
HTTP_HOST 'localhost:8000'
HTTP_PRAGMA 'no-cache'
HTTP_SEC_CH_UA '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"'
HTTP_SEC_CH_UA_MOBILE '?0'
HTTP_SEC_CH_UA_PLATFORM '"macOS"'
HTTP_SEC_FETCH_DEST 'document'
HTTP_SEC_FETCH_MODE 'navigate'
HTTP_SEC_FETCH_SITE 'none'
HTTP_SEC_FETCH_USER '?1'
HTTP_UPGRADE_INSECURE_REQUESTS '1'
HTTP_USER_AGENT ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, ' 'like Gecko) Chrome/94.0.4606.71 Safari/537.36')
LANG 'en_US.UTF-8'
LESS '-R'
LOGNAME 'stevehon'
LSCOLORS 'Gxfxcxdxbxegedabagacad'
LaunchInstanceID 'E0267C04-A338-4823-9028-91AD138CC3C3'
OLDPWD '/Users/stevehon/pyprograms/storefront'
ORIGINAL_XDG_CURRENT_DESKTOP 'undefined'
P9K_SSH '0'
P9K_TTY 'old'
PAGER 'less'
PATH ('/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware ' 'Fusion.app/Contents/Public:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS')
PATH_INFO '/playground/hello/'
PS1 ('(storefront) ' '${$((_p9k_on_expand()))+}${(e)_p9k_t[7]}${_p9k__1-${${:-${_p9k__d::=0}${_p9k__rprompt::=${_p9k__1r-${${:-${_p9k__bg::=NONE}${_p9k__i::=0}${_p9k__sss::=${(Q)${:-"%\\\\{%\\\\}"}}}}+}${${:-${P9K_CONTENT::=}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=8}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(234 234)}:+10}}${_p9k__n:=11}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1r:+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{234\\}%f${${:-${_p9k__w::=%b%K{234\\}%f ' '%b%K{234\\}%f}${_p9k__sss::=%b%K{234\\}%f ' '}${_p9k__i::=1}${_p9k__bg::=234}}+}}${${:-"${${(%):-%j}:#0}"}:+${${:-${P9K_CONTENT::=""}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=12}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(234 234)}:+14}}${_p9k__n:=15}${_p9k__v::=%%%b%K{234\\}%F{037\\}}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rbackground_jobs+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}1}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{234\\}%F{037\\}${${(M)_p9k__e:#11}:+ ' '}$_p9k__v${${:-${_p9k__w::=%b%K{234\\}%F{037\\} ' '%b%K{234\\}%F{037\\}}${_p9k__sss::=%b%K{234\\}%F{037\\} ' '}${_p9k__i::=3}${_p9k__bg::=234}}+}}}${${:-"${${(%):-%#}:#\\#}"}:+${${:-${P9K_CONTENT::=%n@%m}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=16}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(234 234)}:+18}}${_p9k__n:=19}${_p9k__c::=}${_p9k__e::=${${_p9k__1rcontext+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{234\\}%F{180\\}${${:-${_p9k__w::=%b%K{234\\}%F{180\\} ' '%b%K{234\\}%F{180\\}}${_p9k__sss::=%b%K{234\\}%F{180\\} ' '}${_p9k__i::=28}${_p9k__bg::=234}}+}}}${${:-"${${(%):-%#}:#\\%}"}:+${${:-${P9K_CONTENT::=%B%n@%m}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=20}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(234 234)}:+22}}${_p9k__n:=23}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rcontext+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{234\\}%F{178\\}${${:-${_p9k__w::=%b%K{234\\}%F{178\\} ' '%b%K{234\\}%F{178\\}}${_p9k__sss::=%b%K{234\\}%F{178\\} ' '}${_p9k__i::=28}${_p9k__bg::=234}}+}}}${${:-${P9K_CONTENT::=04:50:15 ' 'PM}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=24}}${_p9k__n:=${${(M)${:-x$_p9k__bg}:#x(234 234)}:+26}}${_p9k__n:=27}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1rtime+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${_p9k_t[$_p9k__n]/<_p9k__w>/$_p9k__w}${_p9k__c}%b%K{234\\}%F{066\\}${${:-${_p9k__w::=%b%K{234\\}%F{066\\} ' '%b%K{234\\}%F{066\\}}${_p9k__sss::=%b%K{234\\}%F{066\\} ' '}${_p9k__i::=38}${_p9k__bg::=234}}+}}$_p9k__sss%b%k%f}}${_p9k__lprompt::=${_p9k__1l-${${:-${_p9k__bg::=NONE}${_p9k__i::=0}${_p9k__sss::=%f}}+}${${:-${P9K_CONTENT::="%{d%}${:-"%B%F{039}"}${(Q)${:-"\\\\~"}}${:-"%b%K{234}%F{031}"}/${${${_p9k__d:#-*}:+pyprograms}:-${:-"%F{103}"}pyp${:-"%b%K{234}%F{031}"}${$((_p9k__d+=7))+}}/${:-"%B%F{039}"}storefront${:-"%b%K{234}%F{031}"}%{d%}"}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=28}}${_p9k__n:=${${(M)${:-x234}:#x($_p9k__bg ${_p9k__bg:-0})}:+30}}${_p9k__n:=31}${_p9k__c::="${P9K_CONTENT}"}${_p9k__e::=${${_p9k__1ldir+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c}%b%K{234\\}%F{031\\} ' '${${:-${_p9k__s::=%F{234\\}}${_p9k__ss::=%242F }${_p9k__sss::=%F{234\\}}${_p9k__i::=1}${_p9k__bg::=234}}+}}${(e)_p9k__vcs}%b%k$_p9k__sss%b%k%f}}}+}${(e)_p9k_t[6]}${${_p9k__h::=0}+}${${_p9k__d::=$((_p9k__m-_p9k__h))}+}${_p9k__lprompt/\\%\\{d\\%\\}*\\%\\{d\\%\\}/${_p9k__1ldir-${:-"%B%F{039}"}${(Q)${:-"\\\\~"}}${:-"%b%K{234}%F{031}"}/${${${_p9k__d:#-*}:+pyprograms}:-${:-"%F{103}"}pyp${:-"%b%K{234}%F{031}"}${$((_p9k__d+=7))+}}/${:-"%B%F{039}"}storefront${:-"%b%K{234}%F{031}"}}}${${_p9k__m::=$((_p9k__d+_p9k__h))}+}${${_p9k__g+\n' '}:-${:-"%F{238}"}${${${_p9k__m:#-*}:+${${_p9k__1g+${(pl.$((_p9k__m+1)).. ' '.)}}:-${(pl.$((_p9k__m+1))..-.)}}$_p9k__rprompt${_p9k_t[$((1+!_p9k__ind))]}}:-\n' '}%b%k%f}}${_p9k__2-${_p9k__2l-${${:-${_p9k__bg::=NONE}${_p9k__i::=0}${_p9k__sss::=%f}}+}${${:-"${${:-$_p9k__keymap.$_p9k__zle_state}:#(vicmd.* vivis.* vivli.* *.*overwrite*)}"}:+${${:-${P9K_CONTENT::=❯}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=32}}${_p9k__n:=${${(M)${:-x}:#x($_p9k__bg ${_p9k__bg:-0})}:+34}}${_p9k__n:=35}${_p9k__c::=">"}${_p9k__e::=${${_p9k__2lprompt_char+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c}%b%k%F{076\\}${${:-${_p9k__s::=%F{\\}}${_p9k__ss::=%242F }${_p9k__sss::=%F{\\}}${_p9k__i::=3}${_p9k__bg::=}}+}}}${${:-"${${:-$_p9k__keymap.$_p9k__zle_state}:#(vicmd.* vivis.* vivli.* *.*insert*)}"}:+${${:-${P9K_CONTENT::=▶}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=36}}${_p9k__n:=${${(M)${:-x}:#x($_p9k__bg ${_p9k__bg:-0})}:+38}}${_p9k__n:=39}${_p9k__c::="^"}${_p9k__e::=${${_p9k__2lprompt_char+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c}%b%k%F{076\\}${${:-${_p9k__s::=%F{\\}}${_p9k__ss::=%242F }${_p9k__sss::=%F{\\}}${_p9k__i::=3}${_p9k__bg::=}}+}}}${${:-"${(M)${:-$_p9k__keymap$_p9k__region_active}:#vicmd0}"}:+${${:-${P9K_CONTENT::=❮}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=40}}${_p9k__n:=${${(M)${:-x}:#x($_p9k__bg ${_p9k__bg:-0})}:+42}}${_p9k__n:=43}${_p9k__c::="<"}${_p9k__e::=${${_p9k__2lprompt_char+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c}%b%k%F{076\\}${${:-${_p9k__s::=%F{\\}}${_p9k__ss::=%242F }${_p9k__sss::=%F{\\}}${_p9k__i::=3}${_p9k__bg::=}}+}}}${${:-"${(M)${:-$_p9k__keymap$_p9k__region_active}:#(vicmd1 vivis? vivli?)}"}:+${${:-${P9K_CONTENT::=Ⅴ}${_p9k__n::=}${${${_p9k__bg:-0}:#NONE}:-${_p9k__n::=44}}${_p9k__n:=${${(M)${:-x}:#x($_p9k__bg ${_p9k__bg:-0})}:+46}}${_p9k__n:=47}${_p9k__c::="V"}${_p9k__e::=${${_p9k__2lprompt_char+00}:-${${(%):-$_p9k__c%1(l.1.0)}[-1]}0}}}+}${${_p9k__e:#00}:+${${_p9k_t[$_p9k__n]/<_p9k__ss>/$_p9k__ss}/<_p9k__s>/$_p9k__s}${_p9k__c}%b%k%F{076\\}${${:-${_p9k__s::=%F{\\}}${_p9k__ss::=%242F }${_p9k__sss::=%F{\\}}${_p9k__i::=3}${_p9k__bg::=}}+}}}%b%k$_p9k__sss%b%k%f${:-" ' '%b%k%f"}}}${${COLUMNS::=$_p9k__clm}+}')
PWD '/Users/stevehon/pyprograms/storefront'
QUERY_STRING ''
REMOTE_ADDR '127.0.0.1'
REMOTE_HOST ''
REQUEST_METHOD 'GET'
RUN_MAIN 'true'
SCRIPT_NAME ''
SECURITYSESSIONID '186a9'
SERVER_NAME '1.0.0.127.in-addr.arpa'
SERVER_PORT '8000'
SERVER_PROTOCOL 'HTTP/1.1'
SERVER_SOFTWARE 'WSGIServer/0.2'
SHELL '/bin/zsh'
SHLVL '3'
SSH_AUTH_SOCK '/private/tmp/com.apple.launchd.tAI2CS7hl6/Listeners'
TERM 'xterm-256color'
TERM_PROGRAM 'vscode'
TERM_PROGRAM_VERSION '1.61.0'
TERM_SESSION_ID '9024924D-84F3-42AF-9D18-A805552F1417'
TMPDIR '/var/folders/yv/_csk9nf91_j6zz6yrj8_ng4r0000gn/T/'
TZ 'UTC'
USER 'stevehon'
VIRTUAL_ENV '/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7'
VSCODE_GIT_ASKPASS_MAIN '********************'
VSCODE_GIT_ASKPASS_NODE '********************'
VSCODE_GIT_IPC_HANDLE '/var/folders/yv/_csk9nf91_j6zz6yrj8_ng4r0000gn/T/vscode-git-d038384473.sock'
XPC_FLAGS '0x0'
XPC_SERVICE_NAME '0'
ZSH '/Users/stevehon/.oh-my-zsh'
_ '/Users/stevehon/.local/share/virtualenvs/storefront-87lPcdc7/bin/python3'
__CF_USER_TEXT_ENCODING '0x1F5:0x0:0x0'
wsgi.errors <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
wsgi.file_wrapper <class 'wsgiref.util.FileWrapper'>
wsgi.input <django.core.handlers.wsgi.LimitedStream object at 0x103706860>
wsgi.multiprocess False
wsgi.multithread True
wsgi.run_once False
wsgi.url_scheme 'http'
wsgi.version (1, 0)

### Settings

#### Using settings module `storefront.settings`

|Setting|Value|
| --- | --- |
|ABSOLUTE_URL_OVERRIDES|{}|
|ADMINS|[]|
|ALLOWED_HOSTS|[]|
|APPEND_SLASH|True|
|AUTHENTICATION_BACKENDS|['django.contrib.auth.backends.ModelBackend']|
|AUTH_PASSWORD_VALIDATORS|'********************'|
|AUTH_USER_MODEL|'auth.User'|
|BASE_DIR|PosixPath('/Users/stevehon/pyprograms/storefront')|
|CACHES|{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}|
|CACHE_MIDDLEWARE_ALIAS|'default'|
|CACHE_MIDDLEWARE_KEY_PREFIX|'********************'|
|CACHE_MIDDLEWARE_SECONDS|600|
|CSRF_COOKIE_AGE|31449600|
|CSRF_COOKIE_DOMAIN|None|
|CSRF_COOKIE_HTTPONLY|False|
|CSRF_COOKIE_NAME|'csrftoken'|
|CSRF_COOKIE_PATH|'/'|
|CSRF_COOKIE_SAMESITE|'Lax'|
|CSRF_COOKIE_SECURE|False|
|CSRF_FAILURE_VIEW|'django.views.csrf.csrf_failure'|
|CSRF_HEADER_NAME|'HTTP_X_CSRFTOKEN'|
|CSRF_TRUSTED_ORIGINS|[]|
|CSRF_USE_SESSIONS|False|
|DATABASES|{'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': PosixPath('/Users/stevehon/pyprograms/storefront/db.sqlite3'), 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}}|
|DATABASE_ROUTERS|[]|
|DATA_UPLOAD_MAX_MEMORY_SIZE|2621440|
|DATA_UPLOAD_MAX_NUMBER_FIELDS|1000|
|DATETIME_FORMAT|'N j, Y, P'|
|DATETIME_INPUT_FORMATS|['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M']|
|DATE_FORMAT|'N j, Y'|
|DATE_INPUT_FORMATS|['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']|
|DEBUG|True|
|DEBUG_PROPAGATE_EXCEPTIONS|False|
|DECIMAL_SEPARATOR|'.'|
|DEFAULT_AUTO_FIELD|'django.db.models.BigAutoField'|
|DEFAULT_CHARSET|'utf-8'|
|DEFAULT_EXCEPTION_REPORTER|'django.views.debug.ExceptionReporter'|
|DEFAULT_EXCEPTION_REPORTER_FILTER|'django.views.debug.SafeExceptionReporterFilter'|
|DEFAULT_FILE_STORAGE|'django.core.files.storage.FileSystemStorage'|
|DEFAULT_FROM_EMAIL|'webmaster@localhost'|
|DEFAULT_HASHING_ALGORITHM|'sha256'|
|DEFAULT_INDEX_TABLESPACE|''|
|DEFAULT_TABLESPACE|''|
|DISALLOWED_USER_AGENTS|[]|
|EMAIL_BACKEND|'django.core.mail.backends.smtp.EmailBackend'|
|EMAIL_HOST|'localhost'|
|EMAIL_HOST_PASSWORD|'********************'|
|EMAIL_HOST_USER|''|
|EMAIL_PORT|25|
|EMAIL_SSL_CERTFILE|None|
|EMAIL_SSL_KEYFILE|'********************'|
|EMAIL_SUBJECT_PREFIX|'[Django] '|
|EMAIL_TIMEOUT|None|
|EMAIL_USE_LOCALTIME|False|
|EMAIL_USE_SSL|False|
|EMAIL_USE_TLS|False|
|FILE_UPLOAD_DIRECTORY_PERMISSIONS|None|
|FILE_UPLOAD_HANDLERS|['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']|
|FILE_UPLOAD_MAX_MEMORY_SIZE|2621440|
|FILE_UPLOAD_PERMISSIONS|420|
|FILE_UPLOAD_TEMP_DIR|None|
|FIRST_DAY_OF_WEEK|0|
|FIXTURE_DIRS|[]|
|FORCE_SCRIPT_NAME|None|
|FORMAT_MODULE_PATH|None|
|FORM_RENDERER|'django.forms.renderers.DjangoTemplates'|
|IGNORABLE_404_URLS|[]|
|INSTALLED_APPS|['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.staticfiles']|
|INTERNAL_IPS|[]|
|LANGUAGES|[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]|
|LANGUAGES_BIDI|['he', 'ar', 'ar-dz', 'fa', 'ur']|
|LANGUAGE_CODE|'en-us'|
|LANGUAGE_COOKIE_AGE|None|
|LANGUAGE_COOKIE_DOMAIN|None|
|LANGUAGE_COOKIE_HTTPONLY|False|
|LANGUAGE_COOKIE_NAME|'django_language'|
|LANGUAGE_COOKIE_PATH|'/'|
|LANGUAGE_COOKIE_SAMESITE|None|
|LANGUAGE_COOKIE_SECURE|False|
|LOCALE_PATHS|[]|
|LOGGING|{}|
|LOGGING_CONFIG|'logging.config.dictConfig'|
|LOGIN_REDIRECT_URL|'/accounts/profile/'|
|LOGIN_URL|'/accounts/login/'|
|LOGOUT_REDIRECT_URL|None|
|MANAGERS|[]|
|MEDIA_ROOT|''|
|MEDIA_URL|'/'|
|MESSAGE_STORAGE|'django.contrib.messages.storage.fallback.FallbackStorage'|
|MIDDLEWARE|['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']|
|MIGRATION_MODULES|{}|
|MONTH_DAY_FORMAT|'F j'|
|NUMBER_GROUPING|0|
|PASSWORD_HASHERS|'********************'|
|PASSWORD_RESET_TIMEOUT|'********************'|
|PASSWORD_RESET_TIMEOUT_DAYS|'********************'|
|PREPEND_WWW|False|
|ROOT_URLCONF|'storefront.urls'|
|SECRET_KEY|'********************'|
|SECURE_BROWSER_XSS_FILTER|False|
|SECURE_CONTENT_TYPE_NOSNIFF|True|
|SECURE_HSTS_INCLUDE_SUBDOMAINS|False|
|SECURE_HSTS_PRELOAD|False|
|SECURE_HSTS_SECONDS|0|
|SECURE_PROXY_SSL_HEADER|None|
|SECURE_REDIRECT_EXEMPT|[]|
|SECURE_REFERRER_POLICY|'same-origin'|
|SECURE_SSL_HOST|None|
|SECURE_SSL_REDIRECT|False|
|SERVER_EMAIL|'root@localhost'|
|SESSION_CACHE_ALIAS|'default'|
|SESSION_COOKIE_AGE|1209600|
|SESSION_COOKIE_DOMAIN|None|
|SESSION_COOKIE_HTTPONLY|True|
|SESSION_COOKIE_NAME|'sessionid'|
|SESSION_COOKIE_PATH|'/'|
|SESSION_COOKIE_SAMESITE|'Lax'|
|SESSION_COOKIE_SECURE|False|
|SESSION_ENGINE|'django.contrib.sessions.backends.db'|
|SESSION_EXPIRE_AT_BROWSER_CLOSE|False|
|SESSION_FILE_PATH|None|
|SESSION_SAVE_EVERY_REQUEST|False|
|SESSION_SERIALIZER|'django.contrib.sessions.serializers.JSONSerializer'|
|SETTINGS_MODULE|'storefront.settings'|
|SHORT_DATETIME_FORMAT|'m/d/Y P'|
|SHORT_DATE_FORMAT|'m/d/Y'|
|SIGNING_BACKEND|'django.core.signing.TimestampSigner'|
|SILENCED_SYSTEM_CHECKS|[]|
|STATICFILES_DIRS|[]|
|STATICFILES_FINDERS|['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']|
|STATICFILES_STORAGE|'django.contrib.staticfiles.storage.StaticFilesStorage'|
|STATIC_ROOT|None|
|STATIC_URL|'/static/'|
|TEMPLATES|[{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], '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']}}]|
|TEST_NON_SERIALIZED_APPS|[]|
|TEST_RUNNER|'django.test.runner.DiscoverRunner'|
|THOUSAND_SEPARATOR|','|
|TIME_FORMAT|'P'|
|TIME_INPUT_FORMATS|['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']|
|TIME_ZONE|'UTC'|
|USE_I18N|True|
|USE_L10N|True|
|USE_THOUSAND_SEPARATOR|False|
|USE_TZ|True|
|USE_X_FORWARDED_HOST|False|
|USE_X_FORWARDED_PORT|False|
|WSGI_APPLICATION|'storefront.wsgi.application'|
|X_FRAME_OPTIONS|'DENY'|
|YEAR_MONTH_FORMAT|'F Y'|
```

Sounds like whatever template you’re trying to render at that endpoint /playground/hello/ doesn’t exist or it can’t find it…

Typo?
Path Incorrect?

I think the end point is correct bc I don’t get an error when it returns an HttpResponse object (“Hello World” text w/o html) instead of the html template.

Do you have the hello.html in the playground/templates folder? no typo?

Yes, playground/templates/hello.html

Spelled correctly. No typo.

Okay, that’s certainly weird.

Your template-loader postmortem shows that it didn’t even tried to search playground app.
Also, upon checking your trace log, I found that the INSTALLED_APP settings doesn’t include playground app.

I know you said your endpoint works without templates, so I think you are including the playground app… But, can you check the INSTALLED_APP setting just in case?

The problem is definitely there but I’m not sure what’s causing it.

If there’s no issue, you can try manually including template search directory and place your html there

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [<Your custom template directory goes here>],
        'APP_DIRS': True,
        'OPTIONS': {
            # ... some options here ...
        },
    },
]

Manually including template search directory (in DIRS of settings.py) solves the problem. It seems a bit of a hassle unless all your templates are in a single directory. That’ll do for now. Appreciate your patient and help!

It’s a really odd issue that shouldn’t occur in a battle-tested framework like Django. If you have time you should try running the code provided by the course and see if that makes any difference.

Anyway, if you are using the template system at all, it’s very common to organize all your templates at the project level template directory with subdirectories named after app.

Cheers

I get this same error.

Template-loader postmortem

Django tried loading these templates, in this order:

Using engine django :

  • django.template.loaders.app_directories.Loader : /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/contrib/admin/templates/hello.html (Source does not exist)
  • django.template.loaders.app_directories.Loader : /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/contrib/auth/templates/hello.html (Source does not exist)

I’m new to django and I’m not clear what "Manually including template search directory (in DIRS of settings.py) " means.

Is it the DIRS in settings.py in the TEMPLATES variable?

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’,
‘playground’
],
},
},
]

If so, what should that be set to? Can it be set to a relative path?

/storefront/settings.py:

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

Hi, everyone, to fix this issue you need to go into the main app settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'playground.apps.PlaygroundConfig' -- Add this line, this allow Django to search in this app location for the template folder.
]
1 Like

You can tell me why this line work?

i think it is because we are letting django know that there exists an app named playground which may have other directories like templates.

I had the same issue, and it ended up that I did not add a , after the ‘playground.apps.PlaygroundConfig’ line. All I did was add the , and it started working!

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'playground.apps.PlaygroundConfig', <---- , after line
]
1 Like

This is the answer. I was having the same issue, but before appending ‘.apps.PlaygroundConfig’ to the line, I just appended the comma:

INSTALLED_APPS = [
    'django.contrib.admin', # admin interface for managing data
    'django.contrib.auth', # manage users
    'django.contrib.contenttypes',
    'django.contrib.messages', # Display one-time notifications to users
    'django.contrib.staticfiles', # Serve static files (images, pdf, etc)
    'playground', <---
]