title: How to get the parent dir location
body: <p>this code is get the templates/blog1/page.html  in b.py:</p>
  
  <pre><code>path = os.path.join(os.path.dirname(__file__), os.path.join('templates', 'blog1/page.html'))
  </code></pre>
  
  <p>but i want to get the parent dir location:</p>
  
  <pre><code>aParent
     |--a
     |  |---b.py
     |      |---templates
     |              |--------blog1
     |                         |-------page.html
     |--templates
            |--------blog1
                       |-------page.html
  </code></pre>
  
  <p>and  how to get the aParent location</p>
  
  <p>thanks</p>
  
  <p><strong>updated:</strong></p>
  
  <p>this is right:</p>
  
  <pre><code>dirname=os.path.dirname
  path = os.path.join(dirname(dirname(__file__)), os.path.join('templates', 'blog1/page.html'))
  </code></pre>
  
  <p>or </p>
  
  <pre><code>path = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
  </code></pre>