On Thu, 2009-04-30 at 10:53 -0700, eric.frederich wrote:
> Malcom,
> 
> Thanks for replying.
> 
> Let me try to explain a little more.
> 
> When I said "get a list of XYZ training courses" I did mean getting
> the Course objects back and doing a little logic with them.
> Something I'd want on the XYZ main page would be a listing of upcoming
> training courses for XYZ by location.
> 
> Other than that the XYZ site would be completely separate from the
> training site.
> 
> I'd have urls like...
> 
> http://someserver/XYZ/announements/
> http://someserver/XYZ/presentations/
> http://someserver/XYZ/newsletters/
> http://someserver/XYZ/contact/
> http://someserver/XYZ/about/
> 
> For training I'd have
> 
> http://someserver/training/courses/
> http://someserver/training/categories/
> http://someserver/training/categories/mathcad/
> http://someserver/training/categories/xyz/
> http://someserver/training/offerings/
> http://someserver/training/categories/
> 
> Again, I know this is dead simple if I have my training application
> and my XYZ application in the same Django project.  Because it is so
> dead simple I am wondering if it is the wrong thing to do.
> 
> What I'm asking is if this can this be done if they are in two
> different Django projects using only Django (no web services / soap /
> RCP)?

Okay, I think I understand where you're going. Thinking about "projects"
here may be confusing things, so I'll try to avoid that word and phrase
things a little differently.

Presumably you have some (Django) application -- something you can put
in an INSTALLED_APPS list -- which knows how to retrieve the XYZ
objects. If the main training application is using the same database as
XYZ, then your problem is easy because you can also include the
application that knows how to retrieve XYZ objects in the main training
project's settings file and use it to retrieve the objects from the
database.

If things are in multiple databases -- the XYZ objects in one database
and the main training app primarily using another database -- then
things are a little harder. Two solutions jump to mind then:

One is to create a little HTTP-based API that doesn't necessarily go
through the external site -- it could be as simple as a lighttpd or
Apache server on the internal network with the right settings.py file.
You talk to that API to get back XYZ objects in a form that your code
could read: a simple view that knows how to understand parameters and
returns things in, say, a JSON or XML format, for example (or even send
pickled Python strings over the network, since it's all internal
anyway).

Another option is to do Poor Man's Multi-database support, which isn't
too painful. Here's a good explanation of how that works:
http://www.mechanicalgirl.com/view/multiple-database-connection-a-simple-use-case/

Your "put everything in one project" option certainly is a solution,
too. It's essentially the same as my "everything in the same database"
version. The difference is that I'm trying to get you thinking in terms
of applications which fetch data from the database and using the same
application (the one that handles XYZ objects) in multiple projects --
where a project is a settings file, a root URL config file and a bunch
of applications.

Does that help you at all, or just confuse the issue even further?

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to