Tag Archives: Ptyhon

Running manage.py locally with auto pythonpath

While trying to run my manage.py 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 manage.py 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+