realpython / book2-exercises

Book 2 -- Exercises for the book
168 stars 203 forks source link

Real Python Part 2, Hello World App, Pages 505-515 #45

Closed christopher-hartley closed 7 years ago

christopher-hartley commented 9 years ago

When I attempted the last exercise starting on Page 511 (Templates), my betterhello.html for the better function would not render in my browser, and I kept receiving a "TemplateDoesNotExist at ..." error. I could not figure out where I was going wrong until I went to the RealPython_Book2_Exercises directory that I had, navigated to your project, and started the server to find that the page worked in your project! I then started copying and pasting the 6 or so files of code one by one until the betterhello.html file rendered at localhost:8000/better/. I had the exact same code EXCEPT in the settings.py file (under the "hello_world_project" directory) where there was a TEMPLATES = [....] list in my file where there was not one in yours (starting at line 64 or so). When I deleted this entire list, my betterhello.html file rendered at localhost:8000/better/ . The TEMPLATES list python code looks like this:

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',
            ],
        },
    },
]

Looks like they updated some functionality after the book was written. (I also had the same Django Version 1.8.2).

mjhea0 commented 7 years ago

Updated in v 2.0 of the courses. Coming week of 12/19/2016. https://github.com/realpython/about/blob/master/changelog.csv