Last Updated: February 25, 2016
·
475
· raybesiga

Project Path setting in Django>=1.4

Sometime you want to use the absolute path in Django. Usually you simply add:

import os
gettext = lambda s: s
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))

However, that does not really work due to the new directory structure in Django>=1.4. Better way to do is:

import os
gettext = lambda s: s
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
PROJECT_PATH = os.path.dirname(PROJECT_PATH)

That will surely get it working! Puppies and rainbows!