masa8/Open-Data-Catalog — pull request #1 by masa8 (2013-10-07 15:49:50+00:00)
Title: Fix ImportError cannot import name AdminMediaHandler

After running gunicorn_django, I got an error following:

2013-10-06 16:47:38 [12059] [INFO] Starting gunicorn 0.14.2
2013-10-06 16:47:38 [12059] [INFO] Listening at: http://10.0.2.15:8000 (12059)
2013-10-06 16:47:38 [12059] [INFO] Using worker: sync
2013-10-06 16:47:38 [12062] [INFO] Booting worker with pid: 12062
2013-10-06 16:47:40 [12062] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/var/lib/postgresql/opendatacatalog/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 453, in spawn_worker
worker.init_process()
File "/var/lib/postgresql/opendatacatalog/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 99, in init_process
self.wsgi = self.app.wsgi()
File "/var/lib/postgresql/opendatacatalog/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
self.callable = self.load()
File "/var/lib/postgresql/opendatacatalog/local/lib/python2.7/site-packages/gunicorn/app/djangoapp.py", line 87, in load
mod = util.import_module("gunicorn.app.django_wsgi")
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/var/lib/postgresql/opendatacatalog/local/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py", line 20, in
from django.core.servers.basehttp import AdminMediaHandler
ImportError: cannot import name AdminMediaHandler
2013-10-06 16:47:40 [12062] [INFO] Worker exiting (pid: 12062)
2013-10-06 16:47:41 [12059] [INFO] Shutting down: Master
2013-10-06 16:47:41 [12059] [INFO] Reason: Worker failed to boot.

This is caused by AdminMediaHandler has been removed in Django 1.5.1. and this issue was fixed by #Issue333 (https://github.com/benoitc/gunicorn/issues/333 ) and the fix has been released as gunicorn 0.14.3.

So, I updated requirement.txt, tested it out on Ubuntu 12.04 and made sure it works well.