Jason, [Aside: Your recent emails all seem to be being sent as replies to mails in other threads. This is very confusing for those of us using threaded views in our email clients, since they appear as part of another conversation. It also doesn't look sensible in the Google Groups archive. Can you please start a new thread for your topics? Thanks.]
On Wed, 2006-07-12 at 13:38 -0400, Jason Murray wrote: > I have an existing cgi based app that I'm starting to move over to django. > I'm > looking forward to seeing just what django can do for me. > > Since the DB has quite a bit of data and I'd like to avoid recreating the DB > model in django and moving the actual data, I've elected to use the ispectdb > feature. > > But, I have some questions. > > I've already run 'python manage.py syncdb' > Then I ran 'python manage.py inspectdb' > > I notice that inspectdb picks up the auth tables. I'm assuming I can get rid > of those in generated models.py file. Am I correct in this assumption? I don't understand this question at all > The inspect didn't pick up any of the FKs that M2M's that I have, which I > expected since MySQL doesn't really explicitly record that information. So > I'll be adding those next. > > My main question is when I get the models.py file to match the existing DB, > what do I do next? The documentation says I should syncdb or init. When I do > this will django blow away any existing data, or will it keep what is already > there since the models.py will match what it sees in the DB? Once you have a models.py where the schema it would generate matches what is in your data (or is a strict subset of the database), you don't need to do anything. At that point, Django's idea of what the database tables should look like is compatible with your existing database, so any queries that Django writes will be mapped to write tables, columns, etc. The "syncdb" command is used to create a database from model descriptions, which is the normal way Django development is "driven": you write the model in Python and Django generates the SQL. In this case, you are trying to create a model that matches an existing schema, so nothing needs to be generated. Well, to be accurate, you don't need to run syncdb for your app that is designed to mimic the existing database table. If you are planning to use the admin application or any of the other standard Django apps (see INSTALLED_APPS in the settings file), you need to run syncdb once in order to have those tables installed. You will need to look at the output of "./manage.py sql app_name", though, in order to manually add in any necessary rows to the auth tables, content type table, etc. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---