Hi, all.  I'm trying to figure out how to do this.  I have two django
projects, on different servers (though I have control over each).

On one of the projects (call this the primary project), I would like
to *read* the info from the other (secondary) project.  No need to
modify the secondary project's info, I just want to scrape its info at
will.

Now, I could just reach through the mysql databases and do direct
queries, but I'd really rather use the other project's module
definitions to access the information.

I've set up a second database in settings.py of my primary project,
eg

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'primary',
        'USER': 'sysadmin',
        'PASSWORD': 'xxx',
        'HOST': '127.0.0.1',
        'PORT': '',
    },
    # to examine the models on secondary
    'dcswitchinfo': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'secondary',
        'USER': 'sysadmin',
        'PASSWORD': 'xxx',
        'HOST': 'secondary.com',
        'PORT': '',
    }
}

Now, it seems like I'm going to have to copy the models.py from
secondary over to the primary's directory?  I cant' see any other way
of being able to import the relevant info when I want to write
something up in the views.py.  That raises the question of what else
besides models.py I'd need to copy over from the secondary project.
Ideally I could jsut copy that over, and set up the DATABASE_ROUTERS
to split out where it looks for each model.  (Or just do it manually
using the 'using' method when referencing secondary's classes.)

Is this a reasonable approach, or should I just bite the bullet and do
raw sql commands to pull the info from secondary's mysql db?  Has
anyone done this?  I googled around a fair bit, but all the extra
database examples kept the django project as the central hub, spinning
out the websites or the databases, but not instances of django
installations...

--Cindy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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