On 5 Nov 2020, at 04:11, Marc Johnson <marcjohnson518@gmail.com> wrote:
Hi David,
Thanks again for the feedback. When I remove the 'ENGINE' variable I get the error saying settings.DATABASES is improperly configured, as shown in the snapshot attached below.
But when I add the ENGINE variable, like listed below, I get an 'Internal Server Error':
DATABASES = {
'default': dj_database_url.config(env='DATABASE_URL', conn_max_age=1800),
'ENGINE': 'django.db.backends.postgresql',
}
My db settings in my docker-compose.yml file are also provided below:
db:
image: postgres:11
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- "DATABASE_URL=postgresql://postgres:P#ssw0rd@postgres:5432/ndc_data"
- "POSTGRES_HOST_AUTH_METHOD=trust"
- "POSTGRES_PASSWORD=P#ssw0rd"
- "POSTGRES_USER=postgres"
- "POSTGRES_DB=ndc_data"
- "POSTGRES_HOST=postgres"
networks:
- default
How am I screwing this up so royally!? I did not expect this connection to involve so much troubleshooting.
It shouldn't. Note that env='DATABASE_URL' is entirely redundant and can be omitted.
In any case, check the source code for dj_database_url.config to troubleshoot this, but ENGINE definitely isn't needed here. As you'll see from the source, the url scheme determines the engine used.
Did you validate that DATABASE_URL is set correctly in the container environment?
I suspect this may be the issue here, although the docker-compose.yml looks fine.
Regards,
/d
No comments:
Post a Comment