dcramer/django-oursql — pull request #14 by gabriel-samfira (2013-01-22 12:14:18+00:00)
Title: GIS monkey patching breaks on Django 1.4

Hello,

I tried to use django-oursql with Django 1.4 but I got the traceback bellow. Trying to use the new DATABASES['default']['ENGINE'] instead of DATABASE_ENGINE, breaks even worse. I removed the monkey patch and it seams to be working now. Have a look at the patch and let me know if its okay, or if it breaks anything in the long run.

Traceback (most recent call last):
File "wsgi_gevent.py", line 32, in
got_request_exception.connect(exception_printer)
File "/vps/container/venv/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 74, in connect
if settings.DEBUG:
File "/vps/container/venv/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
self._setup()
File "/vps/container/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/vps/container/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/vps/container/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/vps/container/app/project/__init__.py", line 1, in
import project.signals
File "/vps/container/app/project/signals.py", line 24, in
from project.web.auth.models import Profile
File "/vps/container/app/project/web/auth/models.py", line 1, in
from django.db import models
File "/vps/container/venv/lib/python2.7/site-packages/django/db/__init__.py", line 40, in
backend = load_backend(connection.settings_dict['ENGINE'])
File "/vps/container/venv/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/vps/container/venv/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
backend = load_backend(db['ENGINE'])
File "/vps/container/venv/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
return import_module('.base', backend_name)
File "/vps/container/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/vps/container/venv/lib/python2.7/site-packages/mysql_oursql/standard/base.py", line 46, in
if settings.DATABASE_ENGINE.startswith('mysql'):
File "/vps/container/venv/lib/python2.7/site-packages/django/utils/functional.py", line 185, in inner
return func(self._wrapped, *args)
AttributeError: 'Settings' object has no attribute 'DATABASE_ENGINE'

Gabriel