Reputation: 33412
I am trying to retrieve the top voted items in Django. Here's the relevant line of code:
originalList = [x[0] for x in list(Vote.objects.get_top(Item, endIdx))[startIdx:]]
The indexes are for pagination purposes. When I try to load the page in a browser, I get:
AttributeError at /items/top/
'Settings' object has no attribute 'DATABASE_ENGINE'
However, the attribute it should be looking for is not DATABASE_ENGINE, rather, it is in DATABASES['default']['ENGINE']
. How can this be fixed?
Upvotes: 1
Views: 127
Reputation: 5276
That looks like a pre-django1.0 app, you should check the branches on github: https://github.com/brosner/django-voting/network and use an active fork or consider using an alternative app for this.
Upvotes: 0
Reputation: 11269
Yea, it looks like that code hasn't been touched in 4 years. It claims
Note that this application requires Python 2.3 or later, and Django
0.97-pre or later. You can obtain Python from http://www.python.org/ and
Django from http://www.djangoproject.com/.
At the time, that was most likely the way to define a database engine and is now deprecated. Personally, I would avoid using this, there are probably other issues with it as well...
Upvotes: 1
Reputation: 33412
I've done the following which I guess is the simplest thing to do until django voting is fixed upstream:
at the end of your settings.py
, append:
DATABASE_ENGINE = DATABASES['default']['ENGINE']
Upvotes: 0