Error in Django: no such table

0

You see, something is happening to me in django that the tables I try to create are no longer detected: I get this error message:

Traceback (most recent call last):
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\handlers\exception.py", line 39, in inner
    response = get_response(request)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\handlers\base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\admin\options.py", line 544, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\decorators.py", line 149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\views\decorators\cache.py", line 57, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\admin\sites.py", line 211, in inner
    return view(request, *args, **kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\decorators.py", line 149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\admin\options.py", line 1543, in changelist_view
    self.list_max_show_all, self.list_editable, self,
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\admin\views\main.py", line 79, in __init__
    self.get_results(request)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\admin\views\main.py", line 172, in get_results
    result_count = paginator.count
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\paginator.py", line 72, in count
    return self.object_list.count()
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\query.py", line 369, in count
    return self.query.get_count(using=self.db)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\sql\query.py", line 476, in get_count
    number = obj.get_aggregation(using, ['__count'])['__count']
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\sql\query.py", line 457, in get_aggregation
    result = compiler.execute_sql(SINGLE)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\sql\compiler.py", line 835, in execute_sql
    cursor.execute(sql, params)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "C:\Users\pcx\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\sqlite3\base.py", line 337, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: ciencia_mensaje
[26/May/2017 17:06:20] "GET /admin/ciencia/mensaje/ HTTP/1.1" 500 174330

The model I want to create is this:

class mensaje(models.Model):
    texto=RichTextField(max_length=300)
    usuario=models.OneToOneField(User,related_name='destinatario')
    def __str__(self):
        return self.usuario.username

Edit: Information about the tables in the settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

Also, if I delete the table and use migrate I got this error message:

The following content types are stale and need to be deleted:

    ciencia | mensaje

I also notice that when using makemigrations after adding or deleting the table I get that no change has occurred. The other tables in my project work.

    
asked by Miguel Alparez 26.05.2017 в 17:09
source

0 answers