tags:

views:

59

answers:

1

I have a Django application, and I recently changed the name of the database it is supposed to use. However, manage.py doesn't seem to be using the new database.

I've doublechecked the settings.py file, and I've even added a "print settings.DATABASE_NAME" to the manage.py file, and it prints out the correct name, but still connects to the old database.

For example, using ./manage.py dbshell:

NewDB
Password for user : 
Welcome to psql 8.1.11, the PostgreSQL interactive terminal.
OldDB=>

So as far as I can see, it's completely ignoring what's in the settings file.

What could be causing this?

A: 

I figured out what the problem was.

While manage.py does take the settings file, the djang.conf.settings is loaded from the sys.path rather than what is passed via manage.py.

Apparently, the old location was in the sys.path, and so it was loading the old settings file.