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!
Written by Ray Besiga
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#