user3642266
user3642266

Reputation:

How to configure settings.DATABASES?

./manage.py syncdb shows some error

(ENV)vijay@vijay-Ideapad-Z570:~/nightybuild/heroku-landing$ ./manage.py syncdb
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE
value. Check settings documentation for more details.
(ENV)vijay@vijay-Ideapad-Z570:~/nightybuild/heroku-landing$

in my settings.py

DATABASES = {
                 'default': {
                       'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
                       'NAME': '', # Or path to database file if using sqlite3.
                       # The following settings are not used with sqlite3:
                       'USER': '',
                      'PASSWORD': '',
                     'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
                     'PORT': '', # Set to empty string for default.
}

but my app running successfully in heroku. when deploy its automatically heroku postgres confiqured. But in the local development its showing this error .

Can you please tell guide me how to set database for local?

Upvotes: 0

Views: 654

Answers (1)

Alex
Alex

Reputation: 8539

What type of database are you using? Postgres, MySQL, SQLite? That will be your ENGINE value.

Also, what is your local postgres username and password? And your database name?

Below is an example with a postgres database named testdb with the username myusername and password mypassword:

DATABASES = {
                 'default': {
                       'ENGINE': 'django.db.backends.postgresql_psycopg2',
                       'NAME': 'testdb',
                       'USER': 'myusername',
                      'PASSWORD': 'mypassword',
                     'HOST': '',
                     'PORT': '',
}

You may need to alter depending on your needs. The biggest change will likely be your ENGINE value. Change postgresql_psycopg2 to mysql if using MySQL or sqlite if using SQLite. Also, if using SQLite, you won't have values for USER and PASSWORD.

Upvotes: 0

Related Questions