I am trying to switch a local Django project from the default sqlite3 database to a postgres v.14 database. I've been through several tutorials but nothing seems to work and I'm not sure what I'm doing wrong.
Steps I've performed:
- In my postgres shell I can see there is a database called
testdb
. - I've created a Postgres user
bb
with passwordfoobar
- I ran the following command to grant
bb
access:GRANT ALL PRIVILEGES ON DATABASE testdb TO bb;
- Back in my virtual environment I run
brew services start postgresql
which prints:
==> Successfully started `postgresql@14` (label: homebrew.mxcl.postgresql@14)
- In my Django project's
settings.py
I have the following database configuration:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "testdb",
"USER": "bb",
"PASSWORD": "foobar",
"HOST": "127.0.0.1",
"PORT": "5432",
}
}
- Running
python manage.py makemigrations
produces the following error:
/opt/miniconda3/envs/django-db/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py:158: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': connection to server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user "bb"
warnings.warn(
No changes detected
Is there a step I've missed somewhere? No idea why there's no connection to the server available.