django drop database postgres

  1. Open a terminal or command prompt to access the command line interface.

  2. Navigate to the directory where your Django project is located.

  3. Run the command "python manage.py shell" to open the Django shell.

  4. Inside the Django shell, enter the following commands to drop the PostgreSQL database: from django.db import connection cursor = connection.cursor() cursor.execute("DROP DATABASE yourdatabasename")

  5. Exit the Django shell and confirm the database has been dropped.