fix issue #106. Thanks for the report.

This commit is contained in:
benoitc 2010-10-22 05:20:21 +02:00
parent 0f3f2e6ab7
commit fce191c0db

View File

@ -7,9 +7,6 @@ import os
import sys import sys
import traceback import traceback
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException
from gunicorn.config import Config from gunicorn.config import Config
from gunicorn.app.base import Application from gunicorn.app.base import Application
@ -44,6 +41,7 @@ class DjangoApplication(Application):
sys.exit(1) sys.exit(1)
def load(self): def load(self):
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = self.settings_modname os.environ['DJANGO_SETTINGS_MODULE'] = self.settings_modname
return WSGIHandler() return WSGIHandler()
@ -89,6 +87,8 @@ class DjangoApplicationCommand(Application):
self.cfg.set(k.lower(), v) self.cfg.set(k.lower(), v)
def load(self): def load(self):
from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException
from django.core.handlers.wsgi import WSGIHandler
try: try:
return AdminMediaHandler(WSGIHandler(), self.admin_media_path) return AdminMediaHandler(WSGIHandler(), self.admin_media_path)
except WSGIServerException, e: except WSGIServerException, e: