Running locally with auto pythonpath

While trying to run my locally to syncdb, it complains that my project’s .settings isn’t in the sys.path. Instead of setting it manually, I decided to add it into the script itself:

from os.path import abspath, dirname
sys.path.insert(0, dirname(dirname(abspath(__file__))))

This works perfectly in Django 1.6 on Python 2.7+

Leave a Reply

Your email address will not be published. Required fields are marked *