logeeks
logeeks

Reputation: 4977

models.py not getting generated when using the inspectdb

I am trying to generate models.py from a legacy database using the inspectdb command. Everything was fine, i see the table names being inspected and corresonding classes made in the console, after that operation is completed, I checked the directory where the manage.py is residing, and there was no models.py generated.

Can anyone throw some light on this?

Thanks, John

Upvotes: 3

Views: 885

Answers (1)

Alasdair
Alasdair

Reputation: 308949

The inspectdb command does not automatically create a models.py file, by default it outputs the models to the console.

You can save the output to a file on Unix systems with

$ python manage.py inspectdb > models.py

Note this will overwrite models.py if it already exists!

Upvotes: 6

Related Questions