title: Using Python's os.path, how do I go up one directory?
body: <p>I recently upgrade Django from v1.3.1 to v1.4.</p>
  
  <p>In my old <code>settings.py</code> I have </p>
  
  <pre><code>TEMPLATE_DIRS = (
      os.path.join(os.path.dirname( __file__ ), 'templates').replace('\\', '/'),
      # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
      # Always use forward slashes, even on Windows.
      # Don't forget to use absolute paths, not relative paths.
  )
  </code></pre>
  
  <p>This will point to <code>/Users/hobbes3/Sites/mysite/templates</code>, but <a href="https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py" rel="noreferrer">because Django v1.4 moved the project folder to the same level as the app folders</a>, my <code>settings.py</code> file is now in <code>/Users/hobbes3/Sites/mysite/mysite/</code> instead of <code>/Users/hobbes3/Sites/mysite/</code>.</p>
  
  <p>So actually my question is now twofold:</p>
  
  <ol>
  <li>How do I use <code>os.path</code> to look at a directory one level above from <code>__file__</code>. In other words, I want <code>/Users/hobbes3/Sites/mysite/mysite/settings.py</code> to find <code>/Users/hobbes3/Sites/mysite/templates</code> using relative paths.</li>
  <li>Should I be keeping the <code>template</code> folder (which has cross-app templates, like <code>admin</code>, <code>registration</code>, etc.) at the project <code>/User/hobbes3/Sites/mysite</code> level or at <code>/User/hobbes3/Sites/mysite/mysite</code>?</li>
  </ol>