Django Standalone Script

Try this

import sys, os, django
sys.path.append("/path/to/store") #here store is root folder(means parent).
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "store.settings")
django.setup()

from store_app.models import MyModel

This script you can use anywhere in your system.

Leave a Comment