I am using the following sqlite connection in my myapp/settings.py file:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':testdb:',
#I also tried 'NAME': 'testdb',
},
}
in my manage.py file I am using:
if __name__ == "__main__":
os.environ.setdefault("myapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
On running ./manage.py migrate on the command line I get the following error:
django.db.utils.OperationalError: fe_sendauth: no password supplied
I tried removing psycopg2 and re-ran the migration and get the following error:
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'
I can't work out why django is trying to connect to a psql database where the only DATABSES configuration in the application is for sqlite3.
Could this be due to a dependency?
Try this,
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
This might be helpful for you.
Django only uses DATABASES setting to generate migrations using a specific database driver. I believe somewhere, there is an import which is overriding your DATABASES setting. These are possible places to look for debugging in order of priority.
settings.py file after you set DATABASES variable which might override it.INSTALLED_APPS.