Django/Python EnvironmentError?

simi picture simi · May 26, 2009 · Viewed 10.2k times · Source

I am getting an error when I try to use syncdb:

python manage.py syncdb

Error message:

File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 83, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
EnvironmentError: Could not import settings '/home/simi/workspace/hssn_svn/hssn' (Is it on sys.path? Does ti have syntax errors?): Import by filename is not supported.

I'm a newbie with Django/Python, but I can't figure this error out after having researched online for a while now.

Answer

miku picture miku · May 26, 2009

Your trace states:

Import by filename is not supported.

Which might indicate that you try to import (or maybe set the DJANGO_SETTINGS_MODULE) to the full python filename, where it should be a module path: your.module.settings

You could also try to specify your DJANGO_SETTINGS_MODULE directly from command line, like:

$ DJANGO_SETTINGS_MODULE=your.module.settings ./manage.py syncdb