Reputation: 1290
I've already a functioning website that use sqlite3 but I prefer to restart my website project with an empty project that immediately use PostgreSQL/PostGIS. At the end of the configuration of settings.py
I will make a dump for upload all the sqlite3 tables into the new DB. Nobody models of the old project will modify into this new project. The differece between the old and the new project is only the DBMS.
This is settings.py:
INSTALLED_APPS = [
...
'django.contrib.gis',
]
...
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'my_project_name',
'USER': 'db_user',
'PASSWORD': 'password_of_db_user',
}
}
After this I've tried to test the server with python3 manage.py runserver
but I see this error message:
django.db.utils.OperationalError: FATAL: Peer authentication failed for user "db_user"
I'm sure that NAME, USER and PASSWORD are correct, the db is in localhost. I've created, a couple of week ago, another simple project to learn GeoDjango with this same settings and that website run fine.
Upvotes: 3
Views: 468
Reputation: 10873
Looks like you're missing the host
field in your config:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'my_project_name',
'USER': 'db_user',
'PASSWORD': 'password_of_db_user',
'HOST': 'localhost' # missing part
}
}
Upvotes: 4