title: use django: from "python manage.py shell" to python script
body: <p>I can move to a python project directory (say c:\www\myproject) and then issue </p>
  
  <pre><code>   python manage.py shell
  </code></pre>
  
  <p>and then I can use all modules from django project, say the following piece of commands from the shell command:</p>
  
  <pre><code>import settings 
  from django.template import Template, Context
  
  t=Template("My name is {myname}.")
  c=Context({"myname":"John"})
  f = open('write_test.txt', 'w')
  f.write(t.render(c))
  f.close
  </code></pre>
  
  <p>now, when I tried to collect all my commands into a python script, say "mytest.py", I cannot execute the script.  I must missed something important.</p>
  
  <p>I issued python mytest.py</p>
  
  <p>then I got <code>Import error: could not import settings</code> Is it on sys path?"</p>
  
  <p>I'm in the project directory where settings.py resides.....</p>
  
  <p>Could some one help me out?</p>
  
  <p>thanks.</p>