Setup Django on Dreamhost
Install Django
Use the following command to install Django:
$ svn checkout http://code.djangoproject.com/svn/django/trunk/ django $ cd django $ python setup.py install --prefix=~
Test FastCGI
Get fcgi.py:
$ wget http://svn.saddi.com/py-lib/trunk/fcgi.py
Create FastCGI script /home/user/example.com/hello.fcgi:
#!/usr/bin/env python
def test_app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!\n']
if __name__ == '__main__':
from fcgi import WSGIServer
WSGIServer(test_app).run()
#from flup.server.fcgi import WSGIServer
#WSGIServer(test_app).run()And visit: http://example.com/hello.fcgi to test.
Note
Using flup is not working.
Create dispatch script
My dispatch.py:
#!/usr/bin/env python import sys sys.path.insert(0, '/home/user/lib/python2.4/site-packages') sys.path.insert(0, '/home/user') import os os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings' #from django.core.servers.fastcgi import runfastcgi #runfastcgi(method='threaded', daemonize='false') from fcgi import WSGIServer from django.core.handlers.wsgi import WSGIHandler WSGIServer(WSGIHandler()).run()
Note
Using runfastcgi is not working.
