Sunday, November 28, 2010

Re: newbie: concept question

Thanks for your help. I'll look into your suggestions.

Steve

On Nov 26, 5:08 pm, Łukasz Rekucki <lreku...@gmail.com> wrote:
> On 26 November 2010 21:09, Charlietuna <charlietun...@yahoo.com> wrote:
>
> > Hi all,
>
> > I looked for FAQ, but I couldn't find any. Here's my question. I've
> > been working through the tutorials. I've taken a community college
> > class on Python. So, I have some background there.
> > I've gotten Django installed and working. So far, I've used sqlite3.
>
> > Here's the question:  If you have an MySql database that is already
> > establised with data, etc,
> > how do you get Django to set up the abstraction of the db, so that you
> > can access the data.
>
> > I've worked with the tutorials where you use Django to create the
> > database. You use syncdb command to setup the "abstraction" of the
> > data. How do you do it the other direction?
>
> If you have an existing schema in your database, you can use
> django-admin.py inspectdb[1] to create models from it. It's not
> guaranteed to be 100% correct, so you may need to tweak the generated
> models. If you have a database table that you want to access, but
> don't won't Django to manage it's schema, you can use
> "managed=False"[2] on the model. Hope that helps :)
>
> [1]:http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb
> [2]:http://docs.djangoproject.com/en/dev/ref/models/options/#managed
>
> --
> Łukasz Rekucki

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment