top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+1 vote
22 views

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

posted Aug 26 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social 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 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.
+1 vote

Hi,

Please, I'm working on a dashboard project and so far I am facing challenges when it comes to writing functions for my views.

The difficulty here is, how do I write functions for different parts on a template.

For instance, I want to write a function that takes a user to his profile. How do I do that?

So far this is what I came up with:

@login_required
def show_profile:
  if request.method ==GET:
   return(render, '/profile.html/')
  else:
   return (render, '/login.html/')
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...