Skip to content

Fix for error 'Settings' object has no attribute 'DATABASE_ENGINE' (#208) #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion debug_toolbar/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def sql_explain(request):
params = simplejson.loads(params)
cursor = connections[alias].cursor()

if settings.DATABASE_ENGINE == "sqlite3":
conn = connections[alias].connection
engine = conn.__class__.__module__.split('.', 1)[0]

if engine == "sqlite3":
# SQLite's EXPLAIN dumps the low-level opcodes generated for a query;
# EXPLAIN QUERY PLAN dumps a more human-readable summary
# See http://www.sqlite.org/lang_explain.html for details
Expand Down
16 changes: 9 additions & 7 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

if not settings.configured:
settings.configure(
DATABASE_ENGINE='sqlite3',
# HACK: this fixes our threaded runserver remote tests
# DATABASE_NAME='test_sentry',
# TEST_DATABASE_NAME='test_sentry',
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.admin',
Expand All @@ -30,7 +31,7 @@
SITE_ID=1,
)

from django.test.simple import run_tests
from django.test.simple import DjangoTestSuiteRunner

def runtests(*test_args, **kwargs):
if 'south' in settings.INSTALLED_APPS:
Expand All @@ -41,7 +42,8 @@ def runtests(*test_args, **kwargs):
test_args = ['tests']
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
failures = run_tests(test_args, verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
test_runner = DjangoTestSuiteRunner(verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
failures = test_runner.run_tests(test_args)
sys.exit(failures)

if __name__ == '__main__':
Expand All @@ -50,4 +52,4 @@ def runtests(*test_args, **kwargs):

(options, args) = parser.parse_args()

runtests(failfast=options.failfast, *args)
runtests(failfast=options.failfast, *args)