plz help i found this kinda problem when i run

30 views
Skip to first unread message

ALAKO ABIYO

unread,
Aug 27, 2020, 11:02:04 AM8/27/20
to Django users

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

Ogunsanya Opeyemi

unread,
Aug 27, 2020, 12:34:46 PM8/27/20
to django...@googlegroups.com
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.



--
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...@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.

RANGA BHARATH JINKA

unread,
Aug 28, 2020, 3:37:20 AM8/28/20
to django...@googlegroups.com
Hi,

    Create a templates folder in your base directory where manage.py exists. Change the templates folder path in settings.py as 'DIRS': [os.path.join(BASE_DIR,'templates')]

All the best




--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

sapna Choudhary

unread,
Aug 31, 2020, 7:57:13 AM8/31/20
to django...@googlegroups.com
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.


Reply all
Reply to author
Forward
0 new messages