0

I have forgotten to set my custom user model in the settings file and migrate my project first time. Now i am trying to make migrations again after setting my custom user model with errors -> ... django.db.utils.ProgrammingError: relation "custom_auth_customuser" does not exist ...

I've learned that this is a common error message but i could not understand how to solve it. I have no 'migrations' folder anywhere... Where is the schema that i will change manually?

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, taggit
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying admin.0001_initial...Traceback (most recent call last):
  File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "custom_auth_customuser" does not exist


The above exception was the direct cause of the following exception:


    Traceback (most recent call last):
      File "manage.py", line 22, in <module>
        execute_from_command_line(sys.argv)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
        utility.execute()
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/core/management/base.py", line 305, in run_from_argv
        self.execute(*args, **cmd_options)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/core/management/base.py", line 356, in execute
        output = self.handle(*args, **options)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 202, in handle
        targets, plan, fake=fake, fake_initial=fake_initial
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/migrations/executor.py", line 97, in migrate
        state = self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/migrations/executor.py", line 132, in _migrate_all_forwards
        state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/migrations/executor.py", line 236, in apply_migration
        state = migration.apply(state, schema_editor)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 92, in __exit__
        self.execute(sql)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 112, in execute
        cursor.execute(sql, params)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/backends/utils.py", line 79, in execute
        return super(CursorDebugWrapper, self).execute(sql, params)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
        return self.cursor.execute(sql, params)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
        six.reraise(dj_exc_type, dj_exc_value, traceback)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/Users/burakk/BurakWorks/Web/VIRTUAL_ENVIRONMENTS/python3.5.0_pikto_web_dj_1_10/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
        return self.cursor.execute(sql, params)
    django.db.utils.ProgrammingError: relation "custom_auth_customuser" does not exist
trantu
  • 1,089
  • 8
  • 17
ratata
  • 1,129
  • 14
  • 42
  • This is not a known issue, just a very regularly seen error message. Please post the full error and your model and mention what change you actually made – e4c5 Jun 07 '16 at 11:18
  • I have added the full error. – ratata Jun 07 '16 at 11:29
  • "Please post the full error and your model and mention what change you actually made" – e4c5 Jun 07 '16 at 12:05

1 Answers1

3

If I unterstand your problem correctly you should try this steps:

  • Create a mirgrations folder containing __init__.py in your app
  • Run makemigrations and migrate
trantu
  • 1,089
  • 8
  • 17