title: Using Multiple Databases with django
body: <p>I have to use multiple databases in my project but there is a problem. Model can't see intended database <code>accounts.db</code>.</p>
  <p>when i go localhost:port/admin/app/accounts it says me no such table: accounts. Model is looking for default database not accounts.db how can i do that?</p>
  <p>I tried multiple things that I found on internet but nothing worked.</p>
  <pre><code>settings.py :
  .....
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      },
      
      'accounts': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'accounts.db')
      }
  }
  .....
  
  
  models.py:
  .....
  class Accounts(models.Model):     
      
      email = models.TextField(blank=True, null=True)                                                                                                                    
      phone = models.TextField(blank=True, null=True)                                                                                                                    
      name = models.TextField(blank=True, null=True)                                                                                                                     
      password = models.TextField(blank=True, null=True)                                                                                                                 
      verify = models.IntegerField(blank=True, null=True)                                                                                                                
                                                                                                                                                                         
      class Meta:                                                                                                                                                        
          managed = False
          
          db_table = 'accounts'
  ....
  
  
  Environment:
  
  
  Request Method: GET
  Request URL: http://localhost:port/admin/hede/accounts/
  
  Django Version: 1.11.23
  Python Version: 2.7.15
  Installed Applications:
  ['django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'hede']
  Installed Middleware:
  ['django.middleware.security.SecurityMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  
  Traceback:
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py&quot; in inner
    41.             response = get_response(request)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py&quot; in _get_response
    187.                 response = self.process_exception_by_middleware(e, request)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py&quot; in _get_response
    185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py&quot; in wrapper
    552.                 return self.admin_site.admin_view(view)(*args, **kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py&quot; in _wrapped_view
    149.                     response = view_func(request, *args, **kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py&quot; in _wrapped_view_func
    57.         response = view_func(request, *args, **kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py&quot; in inner
    224.             return view(request, *args, **kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py&quot; in _wrapper
    67.             return bound_func(*args, **kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py&quot; in _wrapped_view
    149.                     response = view_func(request, *args, **kwargs)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py&quot; in bound_func
    63.                 return func.__get__(self, type(self))(*args2, **kwargs2)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py&quot; in changelist_view
    1564.                 self.list_max_show_all, self.list_editable, self,
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/contrib/admin/views/main.py&quot; in __init__
    79.         self.get_results(request)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/contrib/admin/views/main.py&quot; in get_results
    177.         result_count = paginator.count
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/utils/functional.py&quot; in __get__
    35.         res = instance.__dict__[self.name] = self.func(instance)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/core/paginator.py&quot; in count
    79.             return self.object_list.count()
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in count
    364.         return self.query.get_count(using=self.db)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py&quot; in get_count
    499.         number = obj.get_aggregation(using, ['__count'])['__count']
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py&quot; in get_aggregation
    480.         result = compiler.execute_sql(SINGLE)
  
  File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py&quot; in execute_sql
    899.             raise original_exception
  
  Exception Type: OperationalError at /admin/hede/accounts/
  Exception Value: no such table: accounts
  </code></pre>