16.1. Utils Scripts — Python
Standalone scripts
Management commands are preferred for reusable scripts
import sys import os import django sys.path.append('/tmp/myproject') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') django.setup() from shop.models import Customer for customer in Customer.objects.all(): print(customer.name)