Django models across multiple projects/microservices. How to?

后端 未结 4 2031
旧时难觅i
旧时难觅i 2021-02-19 10:34

I\'m wondering how to solve sharing of the model structure between multiple (separated) django projects/microservices. Eg:

  1. Project: API
  2. Project: Users das
4条回答
  •  被撕碎了的回忆
    2021-02-19 11:01

    Two potential options:

    Option 1 - Use a common codebase and deploy multiple instances of it (one for each microservice). You could follow 12factor Apps Methodology and just load a different set of environment variables for each deployed instance. http://12factor.net/

    Option 2 - Split your django code up into self contained applications then have a project for each microservice that just includes these projects and a url config.

    I can expand further if this is helpful?

提交回复
热议问题