title: How can I make Django choose a specific default database when it starts up with command line argument
body: <p>I want Django to use a specific database(<code>sqlite</code>) as default by an argument given when It starts up regardless of <code>settings.py.
  </code>
  For this purpose, I added below code in <code>manage.py</code> so that <code>settings.DATABASES</code> can be set with the argument when it starts up.</p>
  
  <pre><code># manage.py
  
  from myapp import settings
  settings.DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(settings.DB_PATH, sys.argv[3]),
      },
  }
  </code></pre>
  
  <p>But It doesn't work....Django still accesses origin database represented in <code>settings.py</code></p>
  
  <p>I think it is because Django already has done with setting default DB before I change settings.DATABASES in <code>manage.py</code>.</p>
  
  <p>As a result, the change doesn't have any effect.</p>
  
  <p>When does Django choose default database with settings?
  If I can change settings.DATABASES before Django choose default database, I will work i think.</p>
  
  <p>Is there any way to change default database at runtime?
  So that even Django choose already default database I can change it.</p>
  
  <p>It doesn't mean to change database dynamically using `model.objects.using('dbname').</p>