Simple way to reset Django PostgreSQL database?

Probably the easiest way to do this is to recreate the whole database. In Ubuntu, it looks like this:

sudo su postgres
psql
drop database your_database_name;
create database your_database_name with owner user_you_use_in_django;
\q
exit

That’s it. You have clean database. To make it ready to go, you have to run migrations with python manage.py migrate.

If you are working on your project alone, you can delete and recreate migrations, if you want.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)