Thursday, June 29, 2017

Django tutorial - Misleading instructions

Hi Guys,

Im following the tutorial https://docs.djangoproject.com/en/1.11/intro/tutorial03/ and have found that the section on templates doesn't appear to be correct.

The section talks about how django templates are loaded by default if you put them in the correct path:





def auth(request):
return render(request, 'g_auth/index.html')



but when I used a similar example django complained about not being able to find the templates. I ended up having to change the django settings file 'DIRS':

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'g_auth/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',
],
},
},
]

After reading https://docs.djangoproject.com/en/1.11/ref/templates/upgrading/

Hoping to get this clarified as for a beginner this would be quite complicated(assuming I haven't missed the boat completely here)

Cheers,

Justin

--
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/d42b6488-73a9-4cc3-aeaf-2d9d00e5b124%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment