according to the book "python programming from introduction to practice", after modifying the models.py, execute the command python manage.py makemigrations learning_logs, to report an error and ask for advice.
model.py Code
from django.db import models
class Topic(models.Model):
""""""
text = models.CharField(max_length = 200)
date_added = models.DateTimeField(auto_now_add = True)
def __str__ (self):
""""""
return self.text
class Entry(models.Model):
""""""
topic = models.ForeignKey(Topic)
text = models.TextField()
date_added = models.DateTimeField(auto_now_add = True)
class Meta:
verbose_name_plural = "entries"
def __str__(self):
""""""
return self.text[:50] + "..."
the manage.py code is as follows
-sharp!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "learning_log.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn"t import Django. Are you sure it"s installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)