Saturday, November 18, 2017

Re: Problem with Django TemplateDoesNotExist.

On 19/11/2017 4:55 AM, jamesmarcusdavy7 wrote:
> Hello, am using django 1.11.7 with python 2.7.13.But i have a problem
> when trying to load my page,the page gives me this error
>
>
> TemplateDoesNotExist at /
>
> base.html
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
> Django Version: 1.11.7
> Exception Type: TemplateDoesNotExist
> Exception Value:
> base.html
> Exception Location:
> C:\Users\JEMO.JAMES\Desktop\marcus\lib\site-packages\django\template\loader.py
> in get_template, line 25
> Python Executable: C:\Users\JEMO.JAMES\Desktop\marcus\Scripts\python.exe
> Python Version: 2.7.13
> Python Path:
> ['C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\src',
> 'C:\\Windows\\SYSTEM32\\python27.zip',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\DLLs',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\plat-win',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\lib-tk',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\Scripts',
> 'c:\\python27\\Lib',
> 'c:\\python27\\DLLs',
> 'c:\\python27\\Lib\\lib-tk',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus',
> 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\site-packages']
> Server time: Sat, 18 Nov 2017 17:18:25 +0000
>
> My template folder is at the same place my manage.py is and in the
> base.py I have specified the Templates DIRS as
> DIRS:[os.path.join(BASE_DIR,'templates)].How can i  solve this problem?

You could try and convert the Windows pathnames from backslashes to
forward slashes.

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

My own Windows equivalent is ...

TEMPLATES = [ { 'BACKEND':
'django.template.backends.django.DjangoTemplates', 'DIRS': [
os.path.join(APPS_ROOT, 'templates/').replace('\\', '/'), ], 'APP_DIRS':
True, 'OPTIONS': { 'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages', ], }, }, ]



>
> --
> 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
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/74dbc9f0-877c-44d5-aff4-800843c11a29%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/74dbc9f0-877c-44d5-aff4-800843c11a29%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd4e955a-1819-6346-da96-b74edf33e440%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment