You get error:
{{{
File "/home/myUser/path/to/project/projectName/projectName/settings.py",
line 116, in <module>
os.path.join(BASE_DIR, 'templates')
NameError: name 'os' is not defined
}}}
You need to add this line:
{{{
import os
}}}
Then you get this error:
{{{
File "/home/myUser/path/to/project/projectName/projectName/settings.py",
line 116, in <module>
os.path.join(BASE_DIR, 'templates')
NameError: name 'BASE_DIR' is not defined
}}}
Add this line to settings.py:
{{{
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
}}}
Maybe that needs to be in tutorial?
--
Ticket URL: <https://code.djangoproject.com/ticket/20400>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
You are likely using the development version of the tutorial (notice "dev"
in the url) with Django 1.5 instead of the development version of Django.
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:1>
Comment (by anonymous):
This really should be in the tutorial.
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:2>
Comment (by anonymous):
Thanks a lot!
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:3>
Comment (by rando305@…):
I recently had this same problem. It would be nice to update this
Tutorial. However - I am very pleased with the Tutorial and Django. I'm
looking forward to writing code again.
After doing this - I still get an error __file__ is not defined. Any help
would be appreciated.
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:4>
Comment (by timo):
As noted above, if you have this problem, you aren't using the correct
version of the tutorial for the version of Django you have installed.
Please see
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
SupportChannels] for getting help. This ticket tracker is not the place to
get help.
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:5>
* version: 1.5 => 1.6
Comment:
I'm using v1.6 and the following url:
http://django.readthedocs.org/en/1.6.x/intro/tutorial02.html
I'm not using "dev" and the "import os" and setting BASE_DIR is still not
explained.
Love the docs, but things like this detract from the lessons that the
tutorial is actually trying to teach.
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:6>
Comment (by erikr):
Replying to [comment:6 ShawnMTherrien]:
> I'm not using "dev" and the "import os" and setting BASE_DIR is still
not explained.
Yes, this is true. However, this will not lead to the error you describe.
The context of this in the tutorial is that you add the lines to the
settings file. In Django 1.6, the standard settings
[[https://github.com/django/django/blob/stable/1.6.x/django/conf/project_template/project_name/settings.py|already
import os and define BASE_DIR]].
--
Ticket URL: <https://code.djangoproject.com/ticket/20400#comment:7>