title: how to execute python script containing django functions
body: <p>I have a python script <code>test.py</code> that imports <code>make_password</code> function from Django library. It does it like this:</p>
  
  <pre><code>from django.contrib.auth.hashers import make_password
  
  .... a lot of other stuff
  def init():
      ...
  
  if __name__ == "__main__":
      init()
  </code></pre>
  
  <p>So, I want to run it from the command line like:</p>
  
  <pre><code>python test.py
  </code></pre>
  
  <p>But this results in a whole list of error messages, which are all about importing Django module. If I comment out <code>from django.contrib.auth.hashers import make_password</code>, then everything is ok (except the fact that I can't use <code>make_password</code> function).</p>