Python Forum

Full Version: Django debug of templates and home.html
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am having fun trying to initiate a django project with some apps. I am taking an awesome course on udemy called, The Ultimate Beginner's Guide to Django. I was able to follow along and I have a basic blog up and running. Now I am back tracking a little by starting over, this time using a supplementary Django cheat sheet. I encountered a number of issues and resolved them but now I find myself stuck.

When I try navigating to my new homepage, Django provides me with this debug traceback. Django is telling me here that the templates directory doesn’t exist, when it clearly does. Here is a screenshot of Atom so you can see my project’s file tree. As you can see my directory tree for my project, there is an folder which is called, blogitems. and within the blogitems folder is a sub-folder called, templates, then blogitems again and finally my file, home.html

It’s rather confusing. I don’t like the redundancy and the recursive nature of all the app files and directory names. Maybe this is my problem. Can any of your make sense of my debug output to explain why I am getting the error? Can anyone please provide some clarity here?

Here is the cheat sheet:
  1. Creating a Django App
  2. Open terminal and navigate to django project folder (where exists)
  3. django-admin startapp [app name] # use pluralised names, e.g. posts
  4. Navigate to new app folder.
  5. Create new subfolder called “templates”
  6. Navigate to new templates folder.
  7. Create new subfolder called same name as your app (e.g. posts)
  8. Go back to project folder
  9. Open project and add “from [appname] import views”. Then add url path for new view.
    e.g. url(r’^$’, views.home, name=‘home’)
  10. Open and add:
    def home(request):
             return render(request, ‘posts/home.html’)
  11. Navigate to projectfolder\appfolder\templates\appfolder
  12. Create new file ‘home.html’
  13. Go to project folder and open Scroll down to INSTALLED_APPs and add ‘appname’, to the end of the list of apps.
It's this last step where I encounter the error.

Here are the contents of
from django.conf.urls import url
from django.contrib import admin
from blogitems import views

urlpatterns = [
    #initialization admin interface:
    url(r’^$’, views.home, name=‘home’),
I added the app into the
Is there any other information I could provide?

Thanks for your attention.
I find this tremendously frustrating that I cannot edit my post to correct spelling and grammatical errors. The post is only 7 hours old. I read the forum rules and see that taking away the ability to edit is a measure in place to prevent people from changing their posts to avoid members confusing other members. I think this is a bad reason because other projects (like reddit, social networks and the Ubuntu forums) with vibrant online user communities allow members to edit their posts and don't have this problem. I am furious right now because my initial post has some silly grammar and spellings which I now cannot correct.