#27772: Multiple Database without Default
-------------------------------------+-------------------------------------
Reporter: Sammie S. | Owner: nobody
Taunton |
Type: Bug | Status: new
Component: Database | Version: 1.10
layer (models, ORM) | Keywords: database, multiple
Severity: Normal | database, default database,
Triage Stage: | database router
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Following the example on https://docs.djangoproject.com/en/1.10/topics/db
/multi-db/
I created 2 databases, setup the routers in the example, and tested
Data being selected appears to be working however when trying to insert OR
update I'm receiving the following error:
{{{
Performing system checks...
System check identified no issues (0 silenced).
January 24, 2017 - 21:33:54
Django version 1.10.5, using settings 'application.settings'
Starting development server at http://10.4.1.1:80/
Quit the server with CONTROL-C.
Internal Server Error: /en/employee/edit
Traceback (most recent call last):
File "/usr/local/python/lib/python3.6/site-
packages/django/core/handlers/exception.py", line 39, in inner
response = get_response(request)
File "/usr/local/python/lib/python3.6/site-
packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/python/lib/python3.6/site-
packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "/usr/local/python/lib/python3.6/site-
packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/vhosts/admin-install/login/security/gacl.py", line 27, in
_wrapper
return view_func(request, *args, **kwargs)
File "/vhosts/admin-install/employee/views.py", line 112, in edit
result2 = ServiceEdit(request).edit(form.cleaned_data)
File "/usr/local/python/lib/python3.6/contextlib.py", line 52, in inner
with self._recreate_cm():
File "/usr/local/python/lib/python3.6/site-
packages/django/db/transaction.py", line 158, in __enter__
if not connection.get_autocommit():
File "/usr/local/python/lib/python3.6/site-
packages/django/db/backends/base/base.py", line 365, in get_autocommit
self.ensure_connection()
File "/usr/local/python/lib/python3.6/site-
packages/django/db/backends/dummy/base.py", line 21, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly
configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is
improperly configured. Please supply the ENGINE value. Check settings
documentation for more details.
[24/Jan/2017 21:33:58] "POST /en/employee/edit HTTP/1.1" 500 19406
}}}
This is caused by the empty 'default': {} database configuration. I copied
the primary settings into the default area and now things are working.
However, I'd prefer to not be forced into using the default setting, which
from the documentation in a multi-db setup the default is not required to
be filled out, only the key needs to be there (which is fine).
As an additional test I added print() statements to the DB Router
definitions for db_for_read, db_for_write, allow_relation, and
allow_migrate. This would allow me to see when the page is reloaded /
submitted if the query is even passing through the router. Reads were in
fact going to the router as expected, however insert/updates were not. No
print statement, only the error message.
Read Test in DB Router:
{{{
Performing system checks...
System check identified no issues (0 silenced).
January 24, 2017 - 21:46:01
Django version 1.10.5, using settings 'application.settings'
Starting development server at http://10.4.1.1:80/
Quit the server with CONTROL-C.
TEST READ MESSAGE
[24/Jan/2017 21:46:03] "GET /en/employee/edit HTTP/1.1" 200 74622
}}}
So based on this, I can only assume the routing is not happening properly
someplace.
I'm willing to try what is needed to help resolve this.
--
Ticket URL: <https://code.djangoproject.com/ticket/27772>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.afcd61a7044681dd233de3baaaae4f74%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.