Django Switching to New Database (locally)

Oh my local test for Django I am attempting to switch my default local database from an old SQLLite database to a Postgres database to mimic my live environment hosted through heroku. To do this I have the postgres database locally and I changed all my settings.py as shown below, but Django does not recognize that the DB exists. In addition to this, if I run migrate or syncdb it still tries to recreate the old sqllite3 database. Anybody have any experience with this change from one database to another and see any similar problems?

DATABASES = {

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

Answers


You are probably using a wrong settings file, or have something like local_settings.py that overrides your settings, or have duplicate DATABASES entries in your settings. Execute:

python manage.py diffsettings

Do you see the correct DATABASES settings there?


Need Your Help

Python: Read configuration file with multiple lines per key

python configuration-files text-parsing sql

I am writing a small DB test suite, which reads configuration files with queries and expected results, e.g.:

Does Angular require TypeScript?

javascript typescript angular

I have just had a look at the Angular quickstart document and it shows the usage of TypeScript. A thought has just popped into my mind: