run_gunicorn fails on Django trunk #333

prestontimmons opened this Issue Apr 12, 2012 · 3 comments

4 participants


The latest version of Django removed the AdminMediaHandler class. This causes an import error with gunicorn 0.14.2.

2012-04-12 10:40:12 [6414] [INFO] Starting gunicorn 0.14.2
2012-04-12 10:40:12 [6414] [INFO] Listening at: unix:/tmp/gunicorn_site.sock (6414)
2012-04-12 10:40:12 [6414] [INFO] Using worker: sync
2012-04-12 10:40:12 [6440] [INFO] Booting worker with pid: 6440
2012-04-12 10:40:12 [6440] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/home/sites/lib/python2.6/site-packages/gunicorn/", line 453, in spawn_worker
  File "/home/sites/lib/python2.6/site-packages/gunicorn/workers/", line 99, in init_process
    self.wsgi =
  File "/home/sites/lib/python2.6/site-packages/gunicorn/app/", line 101, in wsgi
    self.callable = self.load()
  File "/home/sites/lib/python2.6/site-packages/gunicorn/app/", line 120, in load
    mod = util.import_module("")
  File "/home/sites/lib/python2.6/site-packages/importlib/", line 37, in import_module
  File "/home/sites/lib/python2.6/site-packages/gunicorn/app/", line 20, in <module>
    from django.core.servers.basehttp import AdminMediaHandler
ImportError: cannot import name AdminMediaHandler

due to this commit from Django core

Fixed #18035 -- Removed deprecated AdminMediaHandler?, as per official deprecation timeline. Thanks Jannis Leidel and Ramiro Morales for the review.

@benoitc benoitc closed this in 6cffb5b Apr 17, 2012

I have several instances of Django 1.4 running, and every one of them has AdminMediaHandler in place and gunicorn 0.14.2 works as a charm. From what I see in the commit in Django, the change was made in trunk after the 1.4 release, so it seems to be something for the future 1.5 release.

All this said, I'm not saying the fix to this issue is wrong, only that probably shouldn't apply to Django 1.4, but Django 1.5.

@benoitc benoitc reopened this May 2, 2012

We could probably only detect if AdminHandler is present or not. @davisp @tilgovi thoughts?

@benoitc benoitc closed this in da11bce May 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment