Created
July 11, 2013 17:38
-
-
Save gaganpreet/5977531 to your computer and use it in GitHub Desktop.
Use Django ORM in other Python projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
cwd = os.path.dirname(__file__) | |
sys.path.insert(0, os.path.realpath(os.path.join(cwd, '/path/to/django/root/'))) | |
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings" | |
from myapp.models import ModelA, ModelB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment