import sys, os
sys.path.append('/path/to/your/project')
from django.core.management import setup_environ
from myproject import settings
setup_environ(settings)
How to build sphinx documentation for django project