django - settings.DATABASES is improperly configured -
total newbie here, sorry
- mac osx 10.8 python 2.7 (installed homebrew)
- postgresql 9.4(installed homebrew)
- psycopg2 2.5 (installed macports)
- django 1.0.4 (installed via
python setup.py install
)
i'm using this tutorial, , after starting python manage.py shell
ran
>>> django.db import connection >>> cursor = connection.cursor()
and got following:
traceback (most recent call last): file "<console>", line 1, in <module> file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 15, in complain raise improperlyconfigured("settings.databases improperly configured. " improperlyconfigured: settings.databases improperly configured. please supply engine value. check settings documentation more details.
the databases section of settings.py file looks this:
database_engine = 'django.db.backends.postgresql_psycopg2' #postgresql_psycopg2 database_name = 'mydatabase' #mydatabase database_user = 'sarahr6' # not used sqlite3. database_password = '' # not used sqlite3. database_host = '' # set empty string localhost. not used sqlite3. database_port = '' # set empty string default. not used sqlite3.
so can't figure out why says it's improperly configured?
you need specify databases dictionary in settings.py
:
a dictionary containing settings databases used django. nested dictionary contents maps database aliases dictionary containing options individual database.
databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'mydatabase', 'user': 'sarahr6', 'password': '', 'host': '', 'port': '' } }
Comments
Post a Comment