I was very confused today.
I was trying to use my django app models in my python script.
here is my approach
import os, sys
sys.path.append(
The below script should work provided that the layout of your project (and the path to your settings file) looks like this:
/var/www/cloudloon/horizon/openstack_dashboard/settings.py
#!/usr/bin/env python
import os, sys
sys.path.append("/var/www/cloudloon/horizon")
os.environ["DJANGO_SETTINGS_MODULE"] = "openstack_dashboard.settings"
from django.contrib.auth.models import User
I believe the problem you're seeing is due to the arrangement of your project, or that you need to append another directory level to the sys.path call in the script.
Edit:
Looking at your github project, horizon and openstack_dashboard are on the same directory level. What you'd want to do is set your sys.path to one level higher:
sys.path.append("/var/www/cloudloon")