title: To get PYTHONPATH correct in running Django
body: <p>I run at <a href="http://github.com/cnprog/CNPROG/tree/master" rel="nofollow noreferrer">a cloned Django</a> repository</p>
  
  <pre><code>python manage.py runserver
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>Traceback (most recent call last):
    File "manage.py", line 2, in &lt;module&gt;
      from django.core.management import execute_manager
  ImportError: No module named django.core.management
  </code></pre>
  
  <p>The problem is in my PYTHONPATH according to MacPorts' IRC.</p>
  
  <p>I run</p>
  
  <pre><code>ls -l $(which python)
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>lrwxr-xr-x  1 root  wheel    68B Jan 29 12:27 /usr/local/bin/python -&gt; ../../../Library/Frameworks/Python.framework/Versions/2.6/bin/python
  </code></pre>
  
  <p>This command suggests according to krunk that my PATHs are incorrect: /opt/local/... should be before /usr/local/... </p>
  
  <p>However, I am not sure what he means.</p>
  
  <p>My PYTHONPATH in ~/.zshrc is</p>
  
  <pre><code>export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/:$HOME/.python_libraries:
  </code></pre>
  
  <p>where /opt/local/... is the first PATH as krunk suggests.</p>
  
  <p>I run</p>
  
  <pre><code>which $PYTHONPATH
  /opt/local/Library/Frameworks/Python.framework/Versions/2.6/:/Users/Sam/.python_libraries: not found
  </code></pre>
  
  <p>My PYTHONPATH has something wrong: apparently the /opt/locall/... is not right.</p>
  
  <p><strong>How can you get the PYTHONPATH correct?</strong></p>