Django

Code

Ticket #3893 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

inspectdb correction(introspect)

Reported by: Kashif Razzaqui <kashif.razzaqui@tremyn.com> Assigned to: jacob
Milestone: Component: Documentation
Version: SVN Keywords: inspectdb, introspect
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

On this page - http://www.djangoproject.com/documentation/legacy_databases/

Auto-generate the models

Django comes with a utility that can create models by introspecting an existing database. You can view the output by running this command:

django-admin.py inspectdb --settings=path.to.settings

Save this as a file by using standard Unix output redirection:

django-admin.py inspectdb --settings=path.to.settings > models.py

This feature is meant as a shortcut, not as definitive model generation. See the django-admin.py documentation for more information.

Once you’ve cleaned up your models, name the file models.py and put it in the Python package that holds your app. Then add the app to your INSTALLED_APPS setting.

This will generate environment errors

the command should be

python manage.py inspectdb > models.py

Attachments

Change History

04/08/07 20:44:26 changed by adrian

(In [4964]) Added note to docs/django-admin.txt about the examples using django-admin.txt but the examples being just as relevant for manage.py. Refs #3893

04/08/07 20:47:15 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [4965]) Fixed #3893 -- Changed docs/legacy_databases.txt examples to use manage.py instead of django-admin.py. Thanks, Kashif Razzaqui


Add/Change #3893 (inspectdb correction(introspect))




Change Properties
Action