2017-10-25 django django multi database 1. 在setting.py中定义 1234567891011121314DATABASES = { 'default': { 'NAME': 'app_data', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'postgres_user', 'PASSWORD': 's3krit' }, 'users': { 'NAME': 'user_data', 'ENGINE': 'django.db.backends.mysql', 'USER': 'mysql_user', 'PASSWORD': 'priv4te' }} 2. 使用using手动选择一个数据库 12>>> u = User.objects.using('legacy_users').get(username='fred')>>> u.delete() # will delete from the `legacy_users` database django_182 Newer django delete multi object Older django models objects filter by dict kwargs