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
bbwith passwordfoobar - I ran the following command to grant
bbaccess:GRANT ALL PRIVILEGES ON DATABASE testdb TO bb; - Back in my virtual environment I run
brew services start postgresqlwhich prints:
==> Successfully started `postgresql@14` (label: homebrew.mxcl.postgresql@14)
- In my Django project's
settings.pyI 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 makemigrationsproduces 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.