0
我的models.py代碼中存在OperationalError。 任何人都可以指出問題嗎? 我已經嘗試刪除緩存(以及以前的遷移),並執行它們 - 沒有幫助的問題。Django應用程序中的OperationalError:models.py
from django.db import models
# Create your models here.
class Topic(models.Model):
"""A post within a blog."""
text = models.CharField(max_length=200)
date_added = models.DateTimeField(auto_now_add=True)
def __str__(self):
"""Return a string representation of a model."""
return self.text
class Post(models.Model):
"""Class for Blog Post entries."""
topic = models.ForeignKey(Topic)
text = models.TextField()
date_added = models.DateTimeField(auto_now_add=True)
class Meta:
verbose_name_plural = 'posts'
def __str__(self):
"""Return a string representation of the model."""
return self.text[:50] + "..."
它給了我下面的錯誤,如果這能幫助:
OperationalError at /admin/blogs/post/
no such table: blogs_post
admin.py:
from django.contrib import admin
# Register your models here.
from blogs.models import Topic, Post
admin.site.register(Topic)
admin.site.register(Post)
請添加Django提供給您的錯誤回溯。 –
你在做'manage.py makemigrations'和'manage.py migrate'嗎? –
是的@JohnGordon – Thudiology