run_gunicorn fails on Django trunk #333

Closed
prestontimmons opened this Issue Apr 12, 2012 · 3 comments

4 participants

@prestontimmons

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/arbiter.py", line 453, in spawn_worker
    worker.init_process()
  File "/home/sites/lib/python2.6/site-packages/gunicorn/workers/base.py", line 99, in init_process
    self.wsgi = self.app.wsgi()
  File "/home/sites/lib/python2.6/site-packages/gunicorn/app/base.py", line 101, in wsgi
    self.callable = self.load()
  File "/home/sites/lib/python2.6/site-packages/gunicorn/app/djangoapp.py", line 120, in load
    mod = util.import_module("gunicorn.app.django_wsgi")
  File "/home/sites/lib/python2.6/site-packages/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/sites/lib/python2.6/site-packages/gunicorn/app/django_wsgi.py", line 20, in <module>
    from django.core.servers.basehttp import AdminMediaHandler
ImportError: cannot import name AdminMediaHandler
@ogirardot

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
@haplo

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
@benoitc
Owner

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