Deploying Django app using passenger
Question: I can get through everything on their wiki - and then I'm lost.
<http://wiki.dreamhost.com/Django>

I have a blank Django template, and whenever I try to change anything I get a
500 internal server error.

I have completely developed my django app locally and just want to host it
online - figured it would be easy but am slowly learning that it is not.

I upload my app "videos" to this directory and then put it into the installed
apps and ran "python manage.py syncdb", which finds no fixtures (which I Found
odd).

From there, it just gets an internal server error.

Here is the error I am getting: <http://tweettune.com/> and here is the error
log:

    
    
    [Wed Aug 24 01:49:15 2011] [error] [client 66.212.30.122] Premature end of script headers:
    [Wed Aug 24 01:49:15 2011] [error] [client 66.212.30.122] Premature end of script headers: internal_error.html
    [Wed Aug 24 08:16:40 2011] [error] [client 99.229.160.94] Premature end of script headers:
    [Wed Aug 24 08:16:41 2011] [error] [client 99.229.160.94] Premature end of script headers: internal_error.html
    [Wed Aug 24 08:21:38 2011] [error] [client 99.229.160.94] Premature end of script headers:
    [Wed Aug 24 08:21:38 2011] [error] [client 99.229.160.94] Premature end of script headers: internal_error.html
    [Wed Aug 24 08:27:41 2011] [error] [client 99.229.160.94] Premature end of script headers:
    [Wed Aug 24 08:27:41 2011] [error] [client 99.229.160.94] Premature end of script headers: internal_error.html
    

I've been trying for 6 hours now and can not figure out what I am doing wrong.
I suppose I just don't understand how to deploy an application at all - my
thought process now is take my locally hosted app and replace all the files in
the default django template online. I don't see why this should not work but
it's not. I tried the "hello world app" example by using this code in my
passenger_wdgi file and it works...

    
    
    def application(environ, start_response):
        start_response('200 OK', [('Content-type', 'text/plain')])
        return ["Hello, world!"]
    

Any direction would be helpful.

**EDIT:** Here are the contents of my passenger_wsgi.py file which may be
helpful (although it is automatically generated by dreamhost...so figured it
would be correct).

    
    
    import sys, os
    sys.path.append(os.getcwd())
    os.environ['DJANGO_SETTINGS_MODULE'] = "sotd.settings"
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()
    project_path='/home/tweettune.com/sotd/'
    sys.path.insert(1, project_path)
    


Answer: I had the same problem. The solution was to add the folder of my application
in the wsgi_passenger.py

    
    
    import sys, os
    sys.path.append(os.getcwd())
    sys.path.append(os.path.join(os.getcwd(), 'include your apps folder here'))
    os.environ['DJANGO_SETTINGS_MODULE'] = "cpc.settings"
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()
    

This link was very useful to me:
<http://discussion.dreamhost.com/thread-128918.html>

