Friday, January 30, 2015

Re: using Django on an existing mysql schema

On Sat, Jan 31, 2015 at 3:14 AM, Tobias Dacoir <> wrote:
I'm certainly no Django expert, but I'm not sure if you can use the orm and an already existing database.

Yes, you absolutely can. There's even a management command (inspectdb) to help write the wrapper models, and a Meta flag (managed=False) to make sure the migration tools won't touch those models.
However the documentation states that you can write all queries yourself, essentially not using the orm. However if you do that, I'm wondering why you want to use Django at all?

Because Django has a lot more than just an ORM. There's a forms layer, authentication tools, and lots more.
And pushing business logic into the database sounds like bad design to me (model and controller should be decoupled in MVC like patterns).
It depends what logic you're talking about, and what other tools will be using the same database. "MVC" separation like you are describing assumes that the Controller is shared; if you have to re-implement the controller in two languages, then there's a very strong argument to push some of the controller's functionality into the database.

Russ Magee %-) 

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
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment