Posts tagged with “apache”…

Apache with Django and mod_wsgi

Posted by Aidan, 30th August 2009. Share this:

It's been a busy August for us, working on a number of new and existing projects, and a series of investor code reviews. We plan to start publicising one project in particular soon, helping people with their day-to-day management of IT. We put together a short survey which readers may be interested to complete if they have five minutes.

As usual, most of the development work we're doing at the moment is in Django, and we've recently switched to using mod_wsgi. In putting together our Apache and wsgi configuration, we found that neither mod_wsgi's nor Django's wsgi installation instructions contained a truly portable configuration include. We came up with the script below. It's far from perfect but it does the job for now:

:::python
# Assumes this is in the project root, parallel to settings.py, etc.
# We'd typically have our 'docroot' folder one level down for security reasons.
import os, sys, django.core.handlers.wsgi

project = os.path.dirname(__file__)
workspace = os.path.dirname( project )

sys.path.append( project )
sys.path.append( workspace )

os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % project.rpartition( '/' )[2]
application = django.core.handlers.wsgi.WSGIHandler()

Happy hacking!

This post has 0 comments »

We write about…

.net angel apache audit backup backup extraction bbc bcm.pabx best practice bootlaw bug business business angels business continuity c# call detail recording cdr chief technical officer chief technology officer christmas chrome cio code review colo consulting cto contract cto creative agencies credit card credit crunch crunchies 2008 cto cto for hire data storage data-centre development disaster disaster recovery django domain modelling drinktank due diligence encryption entrepreneurs equity funding events fail firewall focus forcedeth fowa fraud freelance cto fundraising git google google apps google developer day hackintosh hiring hosting ideneb incubator interim cto internet world investment investment. investor investor ios4 ipad iphone iphone 3g iphone backup extractor iphone restore iplayer jason calacanis java job description jobs labs language launch48 law layoffs legal advice logs london lpc mac mashups meetups mentor capital microsoft mobile mod_wsgi molo mvc nda ned networking nortel norway online security os x outsourcing php plan planning protectedcc ps3 raising money realplayer recruiting recruitment reincubate saas scaling security seedcamp seo software staffing start-up start-ups starting a business startup startup cto stealth start-up techcrunch telephone temporary cto testing the start-up depression titanic turnaround ubuntu vc vct virtual cto virtual technology incubation web cto web optimisation web shops weekend wireless wpa xbox360

FeedSubscribe to our feed

Archive

June 2010

January 2010

October 2009

August 2009

July 2009

June 2009

May 2009

April 2009

March 2009

February 2009

January 2009

December 2008

November 2008

October 2008

September 2008

August 2008