Monday, August 31, 2020

Re: plz help i found this kinda problem when i run

You need to create a directory named templates in your current directory i.e., any app or project directory under that templates directory create html file and include that html file with render method.


On Thu 27 Aug, 2020, 10:04 PM Ogunsanya Opeyemi, <ogunsanyaopeyemi4@gmail.com> wrote:
This means that your current_datetime.html template does not exists in any of those directory in the defined directory under templates in your setting.py file.



On Thu, Aug 27, 2020 at 4:01 PM ALAKO ABIYO <aleludago@gmail.com> wrote:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/time/

Django Version: 1.8
Python Version: 2.7.17
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware')

Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/django/mysite/templates/current_datetime.html (File does not exist)
/home/html/example.com/current_datetime.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/home/aa/.local/lib/python2.7/site-packages/django/contrib/admin/templates/current_datetime.html (File does not exist)
/home/aa/.local/lib/python2.7/site-packages/django/contrib/auth/templates/current_datetime.html (File does not exist)



Traceback:
File "/home/aa/.local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/aa/mysite/mysite/views.py" in current_datetime
  12.     t=get_template('current_datetime.html')
File "/home/aa/.local/lib/python2.7/site-packages/django/template/loader.py" in get_template
  46.     raise TemplateDoesNotExist(template_name)

Exception Type: TemplateDoesNotExist at /time/
Exception Value: current_datetime.html

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/898d34f9-b67c-40aa-9dc9-32fab2e5f50cn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABJxPrFbRGNKBYog9HCL2AdNKe5DVtN0WZ1y5x0jrhM3O%3DixMg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP6mExh9t4H8p8sPMZkdZ%2Bgb%2BpeNquNDCdOhja%3DBDFChLeb81Q%40mail.gmail.com.

No comments:

Post a Comment