-
-
Notifications
You must be signed in to change notification settings - Fork 22
Forced marriage of two Django projects #124
-
Say, I have a Django project A that does not currently use idom. I'd like to integrate Django project B, built with idom, into A, while minimizing the contact area. I can think of several options, such as via API or INSTALLED_APPS. But suppose A and B are running in parallel Docker containers, suitably connected; and B only requires some credentials from A to run. Could I conjure up idom components from B in A in a light-weight way? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions
IDOM currently does not provide any built-in methods of sharing generic data between separate Django projects.
In terms of sharing generic data, the current method would likely involve API calls and then use_query database fetching in your components.
In terms of sharing pre-written components from one Django project to the other, that's a bit rough. Especially given they're in separate docker containers. Sharing Python modules between two dockers is a general technological challenge.
You should consider docker exporting a common directory which contain the component files. Then, you can either use importlib to ensure the Python interpreter is aware of these new dotted paths, or contain ...
Replies: 1 comment 1 reply
-
IDOM currently does not provide any built-in methods of sharing generic data between separate Django projects.
In terms of sharing generic data, the current method would likely involve API calls and then use_query database fetching in your components.
In terms of sharing pre-written components from one Django project to the other, that's a bit rough. Especially given they're in separate docker containers. Sharing Python modules between two dockers is a general technological challenge.
You should consider docker exporting a common directory which contain the component files. Then, you can either use importlib to ensure the Python interpreter is aware of these new dotted paths, or contain your components within a Django app then add them to INSTALLED_APPS.
The same technological challenge would exist with trying to reuse a Django view.py files across two separate apps.
In terms of future (undeveloped) options, the following might be related?
If both projects are connected to the same database, then see use_database_state
If both projects can be connected to the same Django channels layer, then see use_layer_state
These options could potentially be used in conjunction with dill to transmit components to a new host project. But that still wouldn't get things importable within your template.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you for the pointers.
Beta Was this translation helpful? Give feedback.