Set up Postgresql database in Django
I have read this topic How to setup PostgreSQL Database in Django?
I just have installed Postgresql db and pcycopg2 module. But when I try
import models from django.db
I get this error message:
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES,
but settings are not configured. You must either define the environment
variable DJANGO_SETTINGS_MODULE or call settings.configure() before
accessing settings.
That's what I have in my global_settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dj_db1',
'USER': 'oleg',
'PASSWORD': 'mypasswd',
'HOST': '',
'PORT': '',
}
}
I tried to understand what I have to do, but did not understand. Can
anyone explain to me in detail, what and where I need to add in the
settings?
No comments:
Post a Comment