On Tue, Jan 24, 2017, Lorenzo Bernardi <lorenzo.berna...@lpn.cnrs.fr> wrote:
> I don't know what is the best approach for the communication between >two django applications. > > We have a website using django and django-cms. We have another >application, the "seminar" app for managing some informations like >seminars, news, people profiles.... They have both their databases and >are on different server. Now we would like to take some information from >the "seminar" appli and show them on the website. My question is how to >retrieve the data from the seminar app. We are developping both >applications so we can do whatever we want but for now we would like to >keep them separated. To display the information on the website I was >thinking of using template tags to gather the information and send them >to the page and I see 3 different ways to do access the information. I think that given what you describe about the way the applications are being developed (by different teams, to meet different needs, which may evolve in different ways) that you are right to keep them loosely-coupled. > 1) consider the distant database as a simple database and perform >queries in SQL. > > 2) use the models.py file of the seminar app (or use inspectdb) and >use database router to gather the information from the distant database >mode. Both these sound like bad ideas, given that you don't have control over the other database and application. > 3) make a REST api of the seminar application ( I have no idea how >to do that and perhaps it is not the correct approach) This sounds by far the most sensible way to proceed. You can't guarantee how the seminar application will contibue to be developed, or even if it will stay a Django application, but as long as the developer contibnue to provide a API that provides your application with the data it needs, you don't even need to care. Now your only problem is to learn how to make REST APIs! But there is plenty of help available for that. (If the two applications were to be run in the same project, and developed with a high degree of co-ordination, then you could consider using django CMS plugins to deliver Seminar information into other pages. But from what you describe, your best approach is to use them as REST clients for the information on the other system.) Daniele -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20170125102724.1383850049%40mail.wservices.ch. For more options, visit https://groups.google.com/d/optout.