Why is the program unable to locate my base.html, when the error message has the correct path?

This is my first time reaching out over the internet, so please forgive me if I violate any formalities. Thanks in advance to anyone taking their time to help me!

I am running my program with Django 4.2.1 and Python 3.11.3. I am using Visual Studio Code on a MacBook.

My program was running fine, until I attempted to create a template html file and use another html file to extend it. I keep getting the TemplateDoesNotExist error, and I am now at a lost as to why. I know it is probably something simple that I am overlooking. I am trying to learn Django, and am hitting a road block here.

The full project can be viewed here:

The copied path to the file from finder → /Users/noahsyler/Documents/Comp Sci/monthly_challenges/templates/base.html

The path from the error page → “/Users/noahsyler/Documents/Comp Sci/monthly_challenges/templates/base.html (Source does not exist)”

- In settings.py, `APP_DIRS = True`
- I have tried `BASE_DIR / "templates"` In DIRS 
- I have tried `os.path.join(BASE_DIR,'templates')` in DIRS
- templates is in the root of the app, the same folder as manage.py
- As far as I can tell, everything is spelled correctly. I copied and pasted the names from the error message into the folder & file names to make sure everything is consistent
- The error message says "monthly_challenges/templates/base.html (Source does not exist)," but this is the correct path 
- I have looked at other posts and asked chatGPT, but I cannot tell what I am doing wrong.
-To make sure it is not an issue with the file permissions, I set the permissions of the file to rwx.

Side note: If you surround a url with the backtick - ` character, it’s not rendered by the forum as a url and so doesn’t trigger those limitations - e.g http://example.com
(Also, if you’re posting code or templates here, you want to surround the entire block of code or template between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```.)

For some reason, I seem to remember reading an earlier thread that some people have had problems with spaces in directory names. (Unfortunately, I’m relying on my memory - I can’t find the relevant thread.) I’d try renaming “Comp Sci” to either “CompSci” or “Comp_Sci” to see if that helps. (You may have other references that might need to be changed as well - I’m not sure.)


Thank you for the feedback! I have updated the link.

I tried changing “Comp Sci” to both “Comp_Sci” and “CompSci,” but the issue persists.

I will set up another environment to run the program in later to see if the issue goes away. This definitely has me stumped right now.

I think I found it. In your index.html you have:

{% extends "base.html "%}

Note you have an extra space after the file name.


That was it! Thank you so much!