Comments (5)
Change the environment variables for the db
service:
environment:
- POSTGRES_USER=hello_django
- POSTGRES_PASSWORD=hello_django
- POSTGRES_DB=hello_django_dev
Review the env var section of https://hub.docker.com/_/postgres for more info.
from django-on-docker.
The volume probably needs to come down. Bring the volume down and try again. (docker-compose down -v)
from django-on-docker.
Hey, thanks for the response but I'm afraid this doesn't solve my problem. According to the link you provided a user and DB with those names should be created. But somehow it still produces the same error.
Here is my config:
.env (this part of env that is visible in django settings)
POSTGRES_DATABASE=django
POSTGRES_USER=django
POSTGRES_PASSWORD=django
POSTGRES_HOST=db
POSTGRES_PORT=5432
docker-compose.yml (env vars set here should create this user and db when image is first run)
...
db:
image: postgres:12.0-alpine
volumes:
- pg_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=django
- POSTGRES_PASSWORD=django
- POSTGRES_DB=django
...
django settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': env('POSTGRES_DATABASE', default='django'),
'USER': env('POSTGRES_USER', default='django'),
'PASSWORD': env('POSTGRES_PASSWORD', default='django'),
'HOST': env('POSTGRES_HOST', default='db'),
'PORT': env('POSTGRES_PORT', default='5432'),
}
}
Unfortunately I still have this error:
django.db.utils.OperationalError: FATAL: role "django" does not exist
from django-on-docker.
I was pretty sure I did this but before posting here I tried again with:
docker rm $(docker ps -a -q) -f
docker volume prune
and look like it worked, thanks!
from django-on-docker.
Hey I'm still getting the same issue trying each step
from django-on-docker.
Related Issues (20)
- Where is certbot and Lets Encrypt? HOT 1
- How to integrate https letsencript HOT 1
- Flake 8 in app/Dockerfile.prod HOT 1
- Entrypoint files break build (container start) when they have Win CR/LF EOLs
- nginx - docker - problem with adding add worker_connections. nginx - directive is not allowed here HOT 1
- Intermittent 502 Errors When Customizing Dockerized Django / Gunicorn / Docker / Postgres HOT 6
- Conflict between dev and prod HOT 1
- Getting stuck on "Media files"
- Not serving static files
- unable to create migration file HOT 2
- Dockerfile missing netcat dependency (apologies if wrong repo for django-tdd-docker) HOT 1
- Please mention the database flush in the Readme HOT 1
- Volumes attached, but no tables in hello_django_dev DB HOT 1
- Copy overrides entrypoint.sh HOT 5
- nginx does not start... HOT 8
- Debug Flag as bool HOT 1
- Entrypoint script not found HOT 1
- Not suitable for production without supervisor process?
- Making media files accessible from host HOT 1
- Entry point error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-on-docker.