2009-07-26

Running Django with wsgiref that also serves Admin media

I wanted to run a Django app using Python's built-in wsgiref module. It also serves Django admin media. Consider this a stepping stone to running your Django app using CherryPy.
from wsgiref.simple_server import make_server
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import AdminMediaHandler
httpd = make_server('', 8000, AdminMediaHandler(WSGIHandler()))
httpd.serve_forever()