If both apps are running on the same host (or more concisely, both apps can
access the database for app1), why not just add a database router to app2
and have it pull the information directly?

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

Another option would be to have logic in app2 that can query against app1
via typical HTTP REST requests (perhaps triggered by an HTTP call to a view
in app2 if the info needs to be pulled on demand), using app2 as if it were
a regular client for app1.

A third option if the information is synced on a regular basis would be to
write Django management commands and run them on a schedule via cron to
pull the data from app1 to app2.

These options are in order of preference, as direct DB access is the
fastest and easiest to manage, but may be negatively affected if the schema
changes in app1.

-James
On Aug 16, 2015 3:33 AM, <duriromp...@gmail.com> wrote:

> I had searched in the web about local communication between apps, but I
> didn't find anything (or, at least, didn't catch it) about calling an app
> from another. Let's say I've this:
> http://localhost:8000/app1/resources/user?id=123
> http://localhost:8000/app2/list_users
>
> Each app (by the way, first time doing a really *RESTfull* service, maybe
> I'm wrong with the style) have their models. *app1* have a table for
> *user*, and *app2* needs to communicate with it to list all the users
> (gived or not a QUERYSTRING for filtering). From *app2.views*, how could
> I get that data in a Django way?
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/34bdde3e-6422-49e0-9285-9113ed0abf7d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/34bdde3e-6422-49e0-9285-9113ed0abf7d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUPkS-9WcHYqTt4_kumwhEKtLX47MPEhJoWbKKawobPoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to