title: Multiple databases: How to make external django app use a different database
body: <p>I'm trying to figure out the best method to do this. As usual, there are some good pointers on <a href="https://docs.djangoproject.com/en/dev/topics/db/multi-db/" rel="nofollow">the django documentation</a>, but I'm still not sure what's the best approach.</p>
  
  <p>The django app uses an essentially non-managed DB (it's rather complex, using views, triggers etc, so for example, syncdb doesn't work). That's ok however, since the DBA here creates his own database migrations, and manages the database irrespective of django.</p>
  
  <p>However, I want to use some external 3rd party apps, and those some time come with some of their own database tables. I'd very much like to be able to <code>syncdb</code> those and manage those independently. Since the app-tables are usually independent of the core-app tables, the idea I'm currently playing with is therefore to use a separate <code>'other'</code> database for 3rd party apps. </p>
  
  <p>Reading through the guide it seems to make sense to create a custom router and based on the app name, route it to this <code>'other'</code> database. However, what happens if the app also needs to interact with existing models? Is it possible / sensible to create a router that will effectively route all of the app-specific <em>tables</em> into the <code>'other'</code> database and anything else to the <code>'default'</code> database? Is there a generic way to accomplish this without hard-coding all 3rd party tables somewhere in the router?</p>