Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChris Komaroff
Courses Plus Student 14,198 PointsIt works for me, CSS applied, but Safari's Web Inspector says 'Error 404'
So I had a typo, debugged with Safari's web inspector, found my typo. But I notice, even though this works fine, Error 404 (not found) 'http://127.0.0.1:8000/static/CSS/layout'. Of course this path does not exist, so I guess it makes sense that Safari complains. I would not notice this Error 404 except I opened web inspector. I don't know if this is a problem, maybe not, just thought I would bring up here and see if anyone has any ideas. I am very new to Django, so this may be a simple and unimportant issue.
3 Answers
Chris Komaroff
Courses Plus Student 14,198 PointsMe again, so I got curious, downloaded Kenneth Love's final code for the entire learning_site project. I still see this error when I open web inspector in safari:
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:8000/static/css/layout.css.map
And this in Terminal window running server:
[03/Jul/2016 15:17:05] "GET /courses/ HTTP/1.1" 200 1250 [03/Jul/2016 15:17:05] "GET /static/css/layout.css.map HTTP/1.1" 404 1781
Yes, static folder is missing, so layout.css.map is missing.
I can prevent this error in settings.py by changing STATIC_URL from STATIC_URL='/static/': STATIC_URL = os.path.join(BASE_DIR, 'assets/') Then create empty file name layout.css.map in assets/css folder.
But I don't know if this is really the way to fix this. I doubt most people see this error, so may be why no questions.
Mauricio Carvalho
5,271 PointsI got the same error. CSS won't load and on the console I get:
[25/Sep/2016 19:43:01] "GET / HTTP/1.1" 200 234 [25/Sep/2016 19:43:01] "GET /static/css/layout.css HTTP/1.1" 404 1653
I'm not running on workspaces, running on my own computer.
Ricky Catron
13,023 PointsDEBUG = True is not causing the error. What DEBUG = True means is if django has some kind of error it will try to explain it and give you an error message instead of displaying a generic 404 error. Your problem that somewhere you are requesting a CSS file that django can't find aka file not found or 404. You either need to remove the line linking to the file or you need to move the file to the path it is searching for.
Chris Komaroff
Courses Plus Student 14,198 PointsInteresting, the error message did say "You're seeing this error because you have DEBUG = True". Yeah, Error 404 sounds wrong, this is weird, thanks for answering.
Ricky Catron
13,023 PointsYou misunderstood. You are seeing the message because debug = true but that is not causing it. Debug = true means show error messages instead of just throwing the error. If you turn debug off you will get the error but no helpful message.
The problem is the file cannot be found. Either the URL is wrong in ur page or the file is in the wrong place on your server.
Georgi Koemdzhiev
12,610 PointsI got here because I get 404 for the same css file "layout.css" anyone found a solution yet? (I watched Kenneth's video several times hoping thatI forgot to do something but everything is identical to his code and it still fails to find this file). Please ask Kenneth to join this discussion
Chris Komaroff
Courses Plus Student 14,198 PointsChris Komaroff
Courses Plus Student 14,198 PointsI clicked on http://127.0.0.1:8000/static/css/layout.css.map, got a page with this message:
age not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/static/css/layout.css.map Raised by: django.contrib.staticfiles.views.serve 'css/layout.css.map' could not be found
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
NOTE THE LAST SENTENCE. DEBUG=True is causing this. I still am not sure why, but it helps to have a handle on the reason. Again, my page is fine, but I see this Error 404 in Safari, Web Inspector.