wsvincent/djangoforprofessionals

Unable to reset database

Closed this issue · 1 comments

Been following the book with the exception of doing some sidesteps when I got curious. This has led to some database problems and I am now in need of a reset.

I'm still only working locally

I've tried the reset_db command included in Django-extensions but it says there are two users using the database and therefore it can't be dropped. I guess it is the two docker containers. Don't know how to work around that.

I've also tried to follow along with this guide. Which says I should be able to reset using this command

docker-compose exec <database service name> psql -U <db_user_name> -d postgres -c “DROP DATABASE <db_name>;”

The problem with that is that I do not know the username nor the name of the database since I use these settings(introduced in chapter 8)

DATABASES = {
    "default": env.dj_db_url("DATABASE_URL",
                             default="postgres://postgres@db/postgres")
}

Any advice?

Hi @jonasfagerlund ,

I'm late in reply but I've been in the same situation. With the Docker Dashboard native apps you can do visually see all running images/containers/volumes. The db is likely one of the Volumes so you can go in there to delete it as needed.

Thanks for the question.