Closed ilovetogetspamed closed 9 years ago
I can reproduce the weirdness of the BASE_DIR
setting though it doesn't produce any 404 issues for me following the commands in the book and this example repo (Python 3.4 on Ubuntu 14.04). It looks like this default has since been changed in Django and worth updating in the book. See https://code.djangoproject.com/ticket/23436 and https://github.com/django/django/commit/caf5cd7ba7c9d73194e394a26c81f1a677d54a6c. Thoughts @juliaelman?
Thanks, again, I just started with Django and wasn't aware that they patched it. Though I don't understand why it continues in to manifest itself. From a fresh project's settings.py file:
...
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
...
This change won't land in Django until the upcoming 1.8 release this/next month. More just pointing out that others had reported a similar issue which prompted the change which wouldn't be difficult to incorporate here (since this chapter doesn't use startproject
). However, it is still isn't clear why you are seeing 404 errors from the info given here.
I forgot the trailing / http://127.0.0.1:8000/spam gives 404. http://127.0.0.1:8000/spam/ give page Thanks again.
Computers are so literal... ;-)
Hello, As I was working with the code in chapter three I got as far as the runserver command prior to figure 3-2 trying to test what I had created so far. Anyhow, it was not rendering any of my pages.
I kept getting "Page not found (404)", I also tried using the example code from github for the chapter. It didn't work either.
I narrowed down the problem to the BASE_DIR setting from my testing.
My Test script
IN Ubuntu BASH