title: Django and Buildout Deployment Problem
body: <p>I am trying to deploy my existing django project via buildout, following loosely the instructions <a href="http://jacobian.org/writing/django-apps-with-buildout/" rel="nofollow">here</a>.  </p>
  
  <p>my buildout.cfg file is:</p>
  
  <pre><code>[buildout]
  parts       =     django python
  develop     =     .
  eggs        =     myproject
  
  [django]
  recipe      =     djangorecipe
  version     =     1.2.3
  project     =     myproject
  projectegg  =     myproject
  settings    =     settings
  wsgi        =     true
  eggs        =     ${buildout:eggs}
  
  [python]
  recipe      =     zc.recipe.egg
  interpreter =     python
  eggs        =     ${buildout:eggs}
  </code></pre>
  
  <p>There are two problems:  </p>
  
  <ol>
  <li>First of all, if i invoke the python interpreter via ./bin/python, i get an import error with import myproject</li>
  <li>Secondly if i try to load the django.wsgi file, i also get an apache error</li>
  </ol>
  
  <pre>[Sun Oct 03 11:57:37 2010] [error] [client ::1] mod_wsgi (pid=5045): Target WSGI script '/usr/src/django/myproject/bin/django.wsgi' cannot be loaded as Python module.
  [Sun Oct 03 11:57:37 2010] [error] [client ::1] mod_wsgi (pid=5045): SystemExit exception raised by WSGI script '/usr/src/django/myproject/bin/django.wsgi' ignored.
  [Sun Oct 03 11:57:37 2010] [error] [client ::1] Traceback (most recent call last):
  [Sun Oct 03 11:57:37 2010] [error] [client ::1]   File "/usr/src/django/myproject/bin/django.wsgi", line 20, in 
  [Sun Oct 03 11:57:37 2010] [error] [client ::1]     application = djangorecipe.wsgi.main('myproject.settings', logfile='')
  [Sun Oct 03 11:57:37 2010] [error] [client ::1]   File "/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg/djangorecipe/wsgi.py", line 15, in main
  [Sun Oct 03 11:57:37 2010] [error] [client ::1]     sys.exit(1)
  </pre>
  
  <p>My django.wsgi file is (updated as per suggested changes):</p>
  
  <pre>
  #!/usr/bin/python
  
  
  import sys
  sys.path[0:0] = [
    '/usr/src/django/myproject/src',
      '/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg',
      '/usr/src/django/myproject/eggs/zc.recipe.egg-1.3.2-py2.6.egg',
      '/usr/src/django/myproject/eggs/zc.buildout-1.5.1-py2.6.egg',
      '/usr/local/lib/python2.6/dist-packages',
      '/usr/local/lib/python2.6/dist-packages',
      '/usr/src/django/myproject/parts/django',
      '/usr/src/django/myproject/eggs/setuptools-0.6c12dev_r85190-py2.6.egg',
      '/usr/src/django/myproject/parts/django',
      '/usr/src/django/myproject',
      '/usr/src/django/myproject/src(/usr/src/django/myproject)',
      '/usr/src/django/myproject',
    ]
  
  import djangorecipe.wsgi
  
  application = djangorecipe.wsgi.main('myproject.settings', logfile='')
  </pre>
  
  <p>my bin/django file is:</p>
  
  <pre>
  #!/usr/bin/python
  
  import sys
  sys.path[0:0] = [
      '/usr/src/django/myproject/src',
      '/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg',
      '/usr/src/django/myproject/eggs/zc.recipe.egg-1.3.2-py2.6.egg',
      '/usr/src/django/myproject/eggs/zc.buildout-1.5.1-py2.6.egg',
      '/usr/local/lib/python2.6/dist-packages',
      '/usr/local/lib/python2.6/dist-packages',
      '/usr/src/django/myproject/parts/django',
      '/usr/src/django/myproject/eggs/setuptools-0.6c12dev_r85190-py2.6.egg',
      '/usr/src/django/myproject/parts/django',
      '/usr/src/django/myproject',
      '/usr/src/django/myproject/src(/usr/src/django/myproject)',
      '/usr/src/django/myproject',
      ]
  
  
  import djangorecipe.manage
  
  if __name__ == '__main__':
      djangorecipe.manage.main('myproject.settings')
  </pre>
  
  <p>Neither the import or the apache server seem to be working</p>