Hi all,
After spending a few hours to solve such simple stupid issue am currently encountering with Django, I would like to know whether it is possible that Django framework does stop to see the registered table.
I am wondering what might cause such issue? Have cleaned cache, restarted pc.
Simple app
models.py
from django.db import models
class Book(models.Model):
ids = models.IntegerField(null=True, blank=True)
title = models.CharField(max_length=100, blank=True, null=True)
subtitle = models.CharField(max_length=200, blank=True, null=True)
authors = models.CharField(max_length=150, blank=True, null=True)
publisher = models.CharField(max_length=150, blank=True, null=True)
published_date = models.DateField() # auto_no_addw=False, default=False
category = models.CharField(max_length=100, blank=True, null=True)
distribution_expense = models.DecimalField(
max_digits=6, decimal_places=2, default=0, null=True, blank=True
)
def __str__(self):
return self.title
admin.py
from django.contrib import admin
admin.site.register(Book)
Error
# OperationalError at /ToDo/admin/myapp/book/
no such table: myapp_book
|Request Method:|GET|
| --- | --- |
|Request URL:|http://localhost:8000/ToDo/admin/myapp/book/|
|Django Version:|4.2|
|Exception Type:|OperationalError|
|Exception Value:|no such table: myapp_book|
|Exception Location:|/home/dostor/.local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py, line 328, in execute|
|Raised during:|django.contrib.admin.options.changelist_view|
|Python Executable:|/usr/bin/python3|
|Python Version:|3.10.12|
|Python Path:|['/mnt/c/Users/aka_a/Documents/Python ' 'Scripts/nodejs/website_node/Coursera/trackApp', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/dostor/.local/lib/python3.10/site-packages', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.10/dist-packages', '/home/dostor/.local/lib/python3.10/site-packages/odf', '/home/dostor/.local/lib/python3.10/site-packages/odf', '/home/dostor/.local/lib/python3.10/site-packages/odf', '/home/dostor/.local/lib/python3.10/site-packages/odf', '/home/dostor/.local/lib/python3.10/site-packages/odf', '/home/dostor/.local/lib/python3.10/site-packages/odf', '/home/dostor/.local/lib/python3.10/site-packages/odf']|
|Server time:|Wed, 03 Apr 2024 14:23:08 +0000|
Thanks for your reply in advance.
Kind regards,
Kanatbek