tags:

views:

28

answers:

1

Suppose that a user creates an instance of MyModel in ProjectA that uses sqlite3 database site1.db. How would I in turn save this instance in site2.db owned by ProjectB?

+1  A: 

You could set up two databases using Django 1.2s multi-db support (eg "db_one" and "db_two") and specify which database you want to save that instance to: myfoo.save(using='db_one')

However, if you're loading from one and potentially saving to another, you could run into a world of data integrity hurt. You should also look at master-slave replication as another solution, or just avoid having to save to a separate database unless you really really have to. The fact that you're dealing with SQLite here implies you're just playing around, rather than dealing with live apps, so if you can avoid this through better design, that's definitely the best way forward

stevejalim
+1. Sane advice.
Manoj Govindan