Inspectdb error django
<p>I have postgresql db. I want to make reverse engeneering from db by command </p>

<pre><code>python3 manage.py inspectdb &gt; models/models.py
</code></pre>

<p>All was ok, but I needed to customize auth. I extends from AbstractBaseUser, and try to reispect, because I was alter fields.Then, I looked up in db, and I saw that django add a pound of tables and I cant reinspect my db. Error:</p>

<pre><code>python3 manage.py inspectdb &gt; models/models.py

  super(ForeignObject, self).contribute_to_class(cls, name, private_only=private_only, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 314, in contribute_to_class
    lazy_related_operation(resolve_related_class, cls, self.remote_field.model, field=self)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 81, in lazy_related_operation
    return apps.lazy_model_operation(partial(function, **kwargs), *model_keys)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 79, in &lt;genexpr&gt;
    model_keys = (make_model_tuple(m) for m in models)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/utils.py", line 23, in make_model_tuple
    "must be of the form 'app_label.ModelName'." % model
ValueError: Invalid model reference 'models.model.Account'. String model references must be of the form 'app_label.ModelName'.
artem@artem-debian:/usr/finstatement/project$ python3 manage.py inspectdb &gt; models/models.py
ERROR OH NO
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/utils.py", line 14, in make_model_tuple
    app_label, model_name = model.split(".")
ValueError: too many values to unpack (expected 2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 22, in &lt;module&gt;
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 199, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "&lt;frozen importlib._bootstrap&gt;", line 2254, in _gcd_import
  File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec
  File "&lt;frozen importlib._bootstrap&gt;", line 1471, in exec_module
  File "&lt;frozen importlib._bootstrap&gt;", line 321, in _call_with_frames_removed
  File "/usr/local/lib/python3.4/dist-packages/django/contrib/admin/models.py", line 37, in &lt;module&gt;
    class LogEntry(models.Model):
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py", line 157, in __new__
    new_class.add_to_class(obj_name, obj)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py", line 316, in add_to_class
    value.contribute_to_class(cls, name)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 700, in contribute_to_class
    super(ForeignObject, self).contribute_to_class(cls, name, private_only=private_only, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 314, in contribute_to_class
    lazy_related_operation(resolve_related_class, cls, self.remote_field.model, field=self)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 81, in lazy_related_operation
    return apps.lazy_model_operation(partial(function, **kwargs), *model_keys)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/fields/related.py", line 79, in &lt;genexpr&gt;
    model_keys = (make_model_tuple(m) for m in models)
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/utils.py", line 23, in make_model_tuple
    "must be of the form 'app_label.ModelName'." % model
ValueError: Invalid model reference 'models.model.Account'. String model references must be of the form 'app_label.ModelName'.
</code></pre>

<p>And it delete all models from models/models.py</p>

<p>I have a dumps now, but maybe I can find a better solution than recreate a DB?</p>

<p>Ok, I found I a solution. Need to delete from manage.py</p>

<pre><code>AUTH_USER_MODEL = 'models.models.Account'
</code></pre>

python django postgresql