- Made a new project by command
django-admin startproject django_33497
. - Set
Debug = False
in settings.py. - Set
ALLOWED_HOSTS = ["*"]
in settings.py. - Updated django database settings in settings.py file, to use local Postgres database and set
CONN_MAX_AGE
to3600
. - Added
STATIC_ROOT = BASE_DIR / 'static'
in settings.py.
- In the root project directory use the
docker-compose up
command to spin up services. - Navigate to
http://localhost/admin/
and log in with superuser (Username & password is django). - Connect to Postgres database.
Database credentials:
Name: django
Host: localhost
Port: 5432
User: django
Password: django
Connect with psql command:
psql -h localhost -p 5432 -d django -U django
To see active database connections, query command SELECT * FROM pg_stat_activity WHERE datname='django';
.