35👍
✅
From the documentation:
--database DATABASE
Specifies the database to introspect. Defaults to
default
.
So you can inspect your second database with:
python manage.py inspectdb --database blah
You cannot inspect both at the same time.
11👍
You can specify a specific database like this:
python manage.py inspectdb --database=blah > you_app/models.py
- [Django]-Warning: Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'
- [Django]-Django: list all reverse relations of a model
- [Django]-How to add new languages into Django? My language "Uyghur" or "Uighur" is not supported in Django
3👍
If you are trying @solarissmoke’s answer for Django 2.*:
Don’t wrap the database name with quotes, otherwise it will give you a KeyError
and a ConnectionDoesnotExist
error.
python manage.py inspectdb --database blah
- [Django]-Python (and Django) best import practices
- [Django]-How to force application version on AWS Elastic Beanstalk
- [Django]-Saving ModelForm error(User_Message could not be created because the data didn't validate)
Source:stackexchange.com