Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » How to create the model in a different database from within the same database server. [RSS Feed]

#1 June 16, 2010 20:40:44

N.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to create the model in a different database from within the same database server.


Which version of django are you working with?

On Jun 16, 2:28 pm, thusjanthan <thusjant...@gmail.com> wrote:
> Hi,
>
> when I mean database I mean the separate databases from within one
> mysql database server. So ex:
>
> DB server: server.example.com
> Databases that are contained in the one instance of mysql:
> People
> Books
>
> I have made the connection in the settings.py at the project level but
> in the individual applications suppose People I would like to create
> the models that write the tables in that database space and the
> application Books to write its models in the Books database. This
> should be possible to do but not sure why its not working.
>
> Any thoughts?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 16, 2010 21:47:44

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to create the model in a different database from within the same database server.


Django 1.2

I have the following setup:

ProjectA
settings.py:
...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'test_database', # Or path to
database file if using sqlite3.
'USER': 'user', # Not used with sqlite3.
'PASSWORD': 'password', # Not used with
sqlite3.
'HOST': '127.0.0.1', # Set to empty
string for localhost. Not used with sqlite3.
'PORT': '3306', # Set to empty string for
default. Not used with sqlite3.
}
}
...

now in the mysql database server the following databases exist:
test_database
Books
People


Under ProjectA director the following applications exist:
Books
People

What I would like to do is create the models within those applications
(Books/People) to write their sql tables to the appropriate database
within my one mysql database server.

eg: I want the create table on Books to be:
create table Books.author ...

Any thoughts?

On Jun 16, 12:40 pm, Nick <nickt...@gmail.com> wrote:
> Which version of django are you working with?
>
> On Jun 16, 2:28 pm, thusjanthan <thusjant...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > when I mean database I mean the separate databases from within one
> > mysql database server. So ex:
>
> > DB server: server.example.com
> > Databases that are contained in the one instance of mysql:
> > People
> > Books
>
> > I have made the connection in the settings.py at the project level but
> > in the individual applications suppose People I would like to create
> > the models that write the tables in that database space and the
> > application Books to write its models in the Books database. This
> > should be possible to do but not sure why its not working.
>
> > Any thoughts?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » How to create the model in a different database from within the same database server. [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support