Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.1K
Vistas
Django migration: django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'classroom_user'")

I am trying to deploy a Django app from a development server to a production server I have set up a virtualenv with python 3.8.10, created the mysql database, I am running in the virtualenv. I get no errors from python manage.py check, get "no changes detected" when running python manage.py makemigrations, but when I run ```python manage.py migrate`` I get the following:

Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying admin.0001_initial...Traceback (most recent call last):...

final line of the traceback:

Django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'classroom_user'")

("classroom" is the name of the app within the project "codex") I just recently rebuilt all of the tables in this database on my development server with no issues.
The database on the production server is empty. models.py is in place and complete. I have tried it both with an empty migrations folder and the migration folder removed. The migration does create django_admin_log, django_content_types, django_migrations, but no other tables.

All of the other posts I have seen on this have been about have foreign key constraints, but in my models.py all of the tables that have foreign keys are specified after the tables where the keys are.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

OK, solved.
I was able to get a different error with a slightly older version of Django (3.2.6 instead of 3.2.8) and on a Windows server instead of Linux. This gave me an error regarding foreign key restraints that I have seen in other posts, but was not an error I had seen before.

I had to perform the migrations for my app first (where classroom is the app within the project.):
python manage.py makemigrations classroom
python manage.py migrate

over 4 years ago · Santiago Trujillo Denunciar

0

This worked for me! Try to check your table ENGINE with this command:

MySQL: SHOW TABLE STATUS WHERE NAME='XXX';

Then find its Engine (It's either MyISAM on InnoDB) After that, change the engine of your newly created table (which throw the error) and match it with your classroom_user table with this command:

MySQL: ALTER TABLE classroom_user ENGINE='XXXX';

Then run migrate again and you're good to go!

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda