Before, i was using SQLite
as a database backend, eveything was fine, but i have reached a point where an RDBMS (postgres)
was required to setup up proper validations, queries, ...
Right after dockerizing postgres
, i started seeing this problem.
Setup:
Django [Not Dockerized] (with ALLOWED_HOSTS = ['*']
)
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "localhost_db",
"USER": "root",
"PASSWORD": "root",
"HOST": "localhost", # set in docker-compose.yml
"PORT": 5432, # default postgres port
}
}
Postgres [Dockerized]
Redis [Dockerized]
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6378)],
},
},
}
docker-compose.yaml
version: '3.9'
services:
redis:
restart: always
image: redis:alpine
expose:
- 6378
ports:
- '6378:6378'
volumes:
- 'redisdata:/data'
command: [ "redis-server", "--bind", "redis", "--port", "6378" ]
db:
container_name: pg_container
image: postgres:alpine
restart: always
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: localhost_db
ports:
- "5432:5432"
pgadmin:
container_name: pgadmin4_container
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: root
ports:
- "5050:80"
volumes:
- postgresdata:/var/lib/postgresql/data/
volumes:
redisdata:
postgresdata:
This is my first time seeing this, anyone has ever faced this issue before ?
Problem has been solved by clearing site data for both 127.0.0.1
and localhost
.