top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Django, How to delete the table in the existing database?

+1 vote
397 views

Anyone can explain how to delete or alter existing table in database?

posted Aug 26, 2018 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Deleting a table in Django can be very tricky.

First, if you are using SQLite which comes with Django and you feel you have messed up your whole table/database do the following
1. Delete the SQLite file. This erases the database.
2. Adjust your models and make migrations again using python manage.py makemigrations and python manage.py migrate

To delete a table, you have to use MySQL connector to make changes to the database.

Last, altering a table is also tricky. If you added new lines of codes to your database which already exists, you have to set blank=0

answer Oct 30, 2018 by Uncle Sherlock
Similar Questions
+1 vote

Is it possible to display a data grid table with django? Basically I am looking for displaying a data from the db table on the web interface through django or some other web interface.

My main application is in Python, that's why I'd like to explore Python possibilities first.

0 votes

Hi,

Is there any default database for Django like LAMP or WAMP in PHP?

+1 vote

I want to count the number of active user in website and also I have to display their IP Address by using python Django framework.

+2 votes
(venv)avinash@dell ~/django_projects/usertracking $ python manage.py runserver 113.193.144.56:80
Performing system checks...

System check identified no issues (0 silenced).
December 27, 2014 - 13:12:42
Django version 1.7.1, using settings 'usertracking.settings'
Starting development server at http://113.193.144.56:80/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned-to.
0 votes

I'm new to Django. Is there any tell how to add a limit filter in Django?

...