Example of how to drop a table in a database with django:
In the terminal go the the folder with the manage.py file and then enter the following command:
python manage.py dbshell
It is going to start a shell associated with the database type. For example with the default SQLite it will returns:
SQLite version 3.35.4 2021-04-02 15:20:15
Enter ".help" for usage hints.
To get all table names just enter:
it will returns for example:
To get the number of rows in a table
sqlite> SELECT COUNT(*) FROM myapp_article;
To drop a table:
DROP TABLE myapp_article;
Hi, I am Ben.
I have developed this web site from scratch with Django to share with everyone my notes. If you have any ideas or suggestions to improve the site, let me know ! (you can contact me using the form in the welcome page). Thanks!