title: django.db.utils.ProgrammingError: (1146 table doesn't exist)
body: <p>I have an problem with migrations in python django. When i try to execute python manage.py makemigrations or migrate there is this error.‍♂️</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File
    "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\backends\utils.py",
    line 65, in execute
        return self.cursor.execute(sql, params)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\backends\mysql\base.py",
    line 101, in execute
        return self.cursor.execute(query, args)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 250, in execute
        self.errorhandler(self, exc, value)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\connections.py",
    line 50, in defaulterrorhandler
        raise errorvalue   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 247, in execute
        res = self._query(query)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 412, in _query
        rowcount = self._do_query(q)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 375, in _do_query
        db.query(q)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\connections.py",
    line 276, in query
        _mysql.connection.query(self, query)
    _mysql_exceptions.ProgrammingError: (1146, "Table 'rc2.eduuser_role' doesn't exist")</p>
    
    <p>The above exception was the direct cause of the following exception:</p>
    
    <p>Traceback (most recent call last):   File "manage.py", line 17, in
    
        execute_from_command_line(sys.argv)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\management__init__.py",
    line 363, in execute_from_command_line
        utility.execute()   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\management__init__.py",
    line 355, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\management\base.py",
    line 283, in run_from_argv
        self.execute(*args, **cmd_options)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\management\base.py",
    line 327, in execute
        self.check()   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\management\base.py",
    line 359, in check
        include_deployment_checks=include_deployment_checks,   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\management\base.py",
    line 346, in _run_checks
        return checks.run_checks(**kwargs)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\checks\registry.py",
    line 81, in run_checks
        new_errors = check(app_configs=app_configs)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\checks\urls.py",
    line 16, in check_url_config
        return check_resolver(resolver)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\core\checks\urls.py",
    line 26, in check_resolver
        return check_method()   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\urls\resolvers.py",
    line 254, in check
        for pattern in self.url_patterns:   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\utils\functional.py",
    line 35, in <strong>get</strong>
        res = instance.<strong>dict</strong>[self.name] = self.func(instance)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\urls\resolvers.py",
    line 405, in url_patterns
        patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)   File
    "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\utils\functional.py",
    line 35, in <strong>get</strong>
        res = instance.<strong>dict</strong>[self.name] = self.func(instance)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\urls\resolvers.py",
    line 398, in urlconf_module
        return import_module(self.urlconf_name)   File "C:\Users\Tim\AppData\Local\Programs\Python\Python36-32\lib\importlib__init__.py",
    line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)   File "", line 994, in _gcd_import   File
    "", line 971, in _find_and_load   File
    "", line 955, in _find_and_load_unlocked 
    File "", line 665, in _load_unlocked<br>
    File "", line 678, in
    exec_module   File "", line 219, in
    _call_with_frames_removed   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\ResourceCenter\urls.py",
    line 24, in 
        url(r'^eduuser/', include("eduuser.urls", namespace="eduuser")),   File
    "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\conf\urls__init__.py",
    line 50, in include
        urlconf_module = import_module(urlconf_module)   File "C:\Users\Tim\AppData\Local\Programs\Python\Python36-32\lib\importlib__init__.py",
    line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)   File "", line 994, in _gcd_import   File
    "", line 971, in _find_and_load   File
    "", line 955, in _find_and_load_unlocked 
    File "", line 665, in _load_unlocked<br>
    File "", line 678, in
    exec_module   File "", line 219, in
    _call_with_frames_removed   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\eduuser\urls.py",
    line 2, in 
        from eduuser import views   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\eduuser\views.py",
    line 7, in 
        from eduuser.forms import ForgotEmailForm   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\eduuser\forms.py",
    line 107, in 
        class ImportUserForm(forms.Form):   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\eduuser\forms.py",
    line 123, in ImportUserForm
        role_choices = tuple([(u'', "Auswählen")] + list([(r.id, str(r)) for r in Role.objects.all()]))   File
    "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\models\query.py",
    line 250, in <strong>iter</strong>
        self._fetch_all()   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\models\query.py",
    line 1118, in _fetch_all
        self._result_cache = list(self._iterable_class(self))   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\models\query.py",
    line 53, in <strong>iter</strong>
        results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)   File
    "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\models\sql\compiler.py",
    line 886, in execute_sql
        raise original_exception   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\models\sql\compiler.py",
    line 876, in execute_sql
        cursor.execute(sql, params)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\backends\utils.py",
    line 80, in execute
        return super(CursorDebugWrapper, self).execute(sql, params)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\backends\utils.py",
    line 65, in execute
        return self.cursor.execute(sql, params)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\utils.py",
    line 94, in <strong>exit</strong>
        six.reraise(dj_exc_type, dj_exc_value, traceback)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\utils\six.py",
    line 685, in reraise
        raise value.with_traceback(tb)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\backends\utils.py",
    line 65, in execute
        return self.cursor.execute(sql, params)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\django\db\backends\mysql\base.py",
    line 101, in execute
        return self.cursor.execute(query, args)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 250, in execute
        self.errorhandler(self, exc, value)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\connections.py",
    line 50, in defaulterrorhandler
        raise errorvalue   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 247, in execute
        res = self._query(query)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 412, in _query
        rowcount = self._do_query(q)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\cursors.py",
    line 375, in _do_query
        db.query(q)   File "C:\Source\Git\Suisseedu\resourcecenter2\ResourceCenter\ResourceCenter\env\lib\site-packages\MySQLdb\connections.py",
    line 276, in query
        _mysql.connection.query(self, query) django.db.utils.ProgrammingError: (1146, "Table 'rc2.eduuser_role'
    doesn't exist")</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>from django.db import models
  from django.utils.translation import gettext_lazy as _
  from settings import base
  from eduuser.managers import EduUserManager
  from phonenumber_field.modelfields import PhoneNumberField
  # ** AUTH USER **
  from django.contrib.auth.models import (
      AbstractBaseUser,PermissionsMixin
  )
  
  # ------------
  # ROLE
  # ------------
  class Role(models.Model):
      name = models.CharField(
          _("Role Name"),
          max_length=100,
          unique=True,
      )
      def __str__(self):
          return self.name
  
  # -------------
  # EduUser
  # -------------
  class EduUser(AbstractBaseUser,PermissionsMixin):
  
      objects = EduUserManager()
  
      USERNAME_FIELD = 'email'
      REQUIRED_FIELDS = []
  
      first_name = models.CharField(
          _("First Name"),
          default="",
          blank=False,       
          max_length=255)
  
      last_name = models.CharField(
          _("Last Name"),
          default = "",
          blank=False,
          max_length=255)
  
      eduId = models.CharField(
          _("EduId"),
          blank=False,
          unique=True,
          db_index=True,
          error_messages={
              'unique': _("A user with that eduId already exists."),
          },
          max_length=255)
  
      age = models.IntegerField(
          _("Age"),
          blank=True,
          null=True,
      )
  
      GENDER_CHOICES = (
          ('N', 'None'),
          ('M', 'Male'),
          ('F', 'Female'),
      )
  
      gender = models.CharField(
          _("Gender"),
          max_length=1,
          choices=GENDER_CHOICES)
  
      email = models.EmailField(
          _("Email"),
          max_length=255,
          unique=True,
          error_messages={
              'unique': _("A user with that email address already exists."),
          },
      )
  
      verify_key = models.IntegerField(blank=True, null=True)
      verify_key_expires = models.DateTimeField(blank=True, null=True)
      email_verify = models.BooleanField(default=False)
  
      password_forgot_key = models.CharField(
          _("Password_Forgot_Key"),
          blank=True,
          unique=True,
          max_length=255)
      password_forgot_key_expires = models.DateTimeField(blank=True, null=True)
  
      health_info = models.TextField(
          _("Health Informations"),
          default="No Special Informations")
      special_info = models.TextField(
          _("Special Informations"),
          default="No Special Informations")
      resume_info = models.TextField(
          _("Biography"),
          default="No Bio set")
  
      is_active = models.BooleanField(default=True)
      is_admin = models.BooleanField(default=False)
      is_first_steps = models.BooleanField(default=True)
  
      date_of_birth = models.DateField(default="2000-01-01")
      school_start_date = models.DateField(default="2000-01-01")
  
      eduuser_read = models.ManyToManyField(
          base.AUTH_USER_MODEL,
          related_name="eduuser_read_set",
          blank=True,
      )
  
      eduuser_write = models.ManyToManyField(
          base.AUTH_USER_MODEL,     
          related_name="eduuser_write_set",
          blank=True,
      )
  
      role = models.ManyToManyField(
          "Role",
          _("Role"),
          blank=False,
          db_index=True,
      )
  
      address = models.ForeignKey("country.Address",
          blank=True,
          null=True,
          default=None,
      )
  
      phone_number = PhoneNumberField(blank=True)
  
      def get_full_name(self):
          # The user is identified by their email address
          return "" + self.first_name + " " + self.last_name 
      def get_short_name(self):
          # The user is identified by their email address
          return self.email
      def has_perm(self, perm, obj=None):
          "Does the user have a specific permission?"
          # Simplest possible answer: Yes, always
          return True
      def has_module_perms(self, app_label):
          "Does the user have permissions to view the app `app_label`?"
          # Simplest possible answer: Yes, always
          return True
      def is_staff(self):
          "Is the user a member of staff?"
          # Simplest possible answer: All admins are staff
          return self.is_admin
      def __str__(self):
          if self.first_name and self.last_name:
              return "" + self.first_name + " " + self.last_name
          else:
              return "" + self.email
  
  # -------------
  # Import Maching Table
  # -------------
  
  class ImportMatch(models.Model):
  
      role = models.OneToOneField(
          "Role",
          blank=False,
          db_index=True,
          related_name="role_host_set"
      )
  
      role_allowed = models.ManyToManyField(
          "Role",
          blank=False,
          db_index=True,
          related_name="allowed_role_set"
      )
  
      def __str__(self):
          return "" + str(self.role) + " Import Allowed Table"
  
  # -------------
  # Import Role Mapper
  # -------------
  class RoleMapper(models.Model):
  
      role = models.OneToOneField(
          "Role",
          blank=False,
          db_index=True,
      )
  
      role_map = models.TextField(
          _("Trennen mit Komma"),
          blank=False,
      )
  
      def __str__(self):
          return "" + str(self.role) + " Mapper"
  </code></pre>
  
  <p>Can somebody help me by this problem ?
  Version Python: 3.6.6
  Version Django: 1.11.3</p>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>role_choices = tuple([(u'', "Auswählen")] + list([(r.id, str(r)) for r in Role.objects.all()]))
  role = forms.ChoiceField(widget=forms.Select, choices=role_choices)
  </code></pre>