import os os.environ['DJANGO_SETTINGS_MODULE'] = '项目名.settings'import djangodjango.setup()from blog import modelsentry = models.Entry.objects.get(pk=1)tech_blog = models.Blog.objects.get(name='科技')print(entry, tech_blog)