import sys
sys.path.append('/home/myuser/svn-repos/myproject')
from myproject.settings import *
But, it says module not found when I run the script?
By the way, settings.py has been set up and manage.py syncdb works.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You want
sys.path.append('/home/myuser/svn-repos')instead. Then when youimport myproject, it looks insvn-reposfor themyprojectfolder, and looks in that forsettings.Alternatively, leave it as is and just
import settings. This is less good because it’s less specific and you may end up importing something other than what you intend.You may also want to consider
sys.path.insert(0, 'yourpath')because python starts at the beginning of that dict and works backwards, so whatever you put at the front takes precedence, solving the aforementionedsettingsproblem.