Django - how to specify a database for a model?

前端 未结 6 1408
滥情空心
滥情空心 2020-11-29 04:53

Is there a way to specify that a model (or app, even) should only ever use one particular database?

I am working with a legacy database that I don\'t want to change.

6条回答
  •  没有蜡笔的小新
    2020-11-29 05:52

    As far as I know you can't specify the database directly with the model since it would kind of prevent the app from ever being reusable, but from what I can see in the docs:

    https://docs.djangoproject.com/en/1.8/topics/db/multi-db/

提交回复
热议问题