【发布时间】:2021-04-03 04:29:06
【问题描述】:
运行 django 应用时遇到上述错误。究竟需要改变什么? comment_body = models.TextField() 方面很可能是罪魁祸首,因为它存储了可以不同长度的 reddit cmets。当我做一个 git clone 并在我的本地运行它时,奇怪的是它可以工作。
模型.py
from django.db import models
# Create your models here.
class Subreddit(models.Model):
# Field for storing the name of a subreddit
subreddit_name = models.CharField(max_length=200, unique=True)
# Field for storing the time the model object was last saved
last_updated = models.DateTimeField(auto_now=True)
class Submission(models.Model):
subreddit = models.ForeignKey(Subreddit, on_delete=models.CASCADE)
# The Reddit submission id of the object
submission_id = models.CharField(max_length=200, unique=True)
# Reddit Submission URL
url = models.URLField(max_length=200)
# Reddit Submission Title
title = models.CharField(max_length=200)
class SubmissionComment(models.Model):
# Parent submission object
submission = models.ForeignKey(Submission, on_delete=models.CASCADE)
# Text of the comment
comment_body = models.TextField()
class Meme(models.Model):
memeurl = models.URLField(max_length=200)
编辑:
【问题讨论】:
标签: python python-3.x django postgresql heroku