Django models across multiple projects/microservices. How to?

后端 未结 4 2032
旧时难觅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:08

    If you want to use same models in different python apps (not modules, but apps, with different uwsgi-instances etc.), then I think that the much common and handy solution - provide interface for these models through some API:

    1. You can build REST interface in each of your projects, and then call appropriate API methods to get result.
    2. You can use Celery package to build internal API based on the AMQP transport. Then you need to configure your apps to listen some RabbitMQ queue which will be used as message storage for your projects communnication.

提交回复
热议问题