1 import os 2 import sys 3 import django 4 sys.path.append(r'C:\Users\Administrator\PycharmProjects\your projectname') 5 6 os.chdir(r'C:\Users\Administrator\PycharmProjects\your projectname') 7 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "your projectname.settings") 8 django.setup() 9 10 from crm import models 11 12 v = models.Customer.objects.all() 13 print(v)