Ankita Basu
Ankita Basu

Reputation: 61

How to resolve Django Administration Problem with "no such table"?

I am able to follow the instructions for Creation and Activation for Database Model from the book "Django for Beginners" by William S. Vincent. I am able to reach the first image, but then after that 'get' and 'post' requests probably are not working. adding my code for models.py :

    from django.db import models

class Post(models.Model):
    text = models.TextField()

The following is from admin.py file:

from django.contrib import admin

from .models import Post
admin.site.register(Post)

1. I am able to follow the instructions to this point given in the book "Django for Beginners" by William S. Vincent but when I am trying to save the content getting the following error

2. this is the error browser page

Upvotes: 0

Views: 170

Answers (1)

Yogesh
Yogesh

Reputation: 801

This error occurs when you missed makemigrations or migrate thus the table is not available in the DB itself.

So run the following commands:

  1. python manage.py makemigrations
  2. python manage.py migrate

If the above didn't work, drop the DB and try these once again.

Upvotes: 1

Related Questions