Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

890
Views
¿Por qué obtengo una excepción 'ProgrammingError: la relación "auth_user" no existe' cuando ejecuto pruebas?

Recientemente migré un proyecto de Django de la versión 1.9.1 a la 3.2.7.

Ahora estoy tratando de escribir algunas pruebas nuevas y recibo este error:

 # python manage.py test Creating test database for alias 'default'... Got an error creating the test database: database "test_django" already exists Type 'yes' if you would like to try deleting the test database 'test_django', or 'no' to cancel: yes Destroying old test database for alias 'default'... Traceback (most recent call last): File "/opt/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedTable: relation "auth_user" does not exist

Entiendo que esto se debe a que actualmente no tengo ningún directorio de 'migraciones', ya que cloné el repositorio de git y la base de datos ya existía cuando el proyecto Django se estaba ejecutando en la versión 1.9.1.

He leído:

  • esta pregunta
  • También este .
  • También esto .

Todos ellos recomiendan ejecutar migraciones, pero:

 # python manage.py makemigrations No changes detected # python manage.py makemigrations auth No changes detected in app 'auth'

Nuevamente, creo que esto se debe a que el esquema DB ya existía antes de actualizar a 3.2.

Parece que no puedo resolver el problema al ejecutar el enfoque de migraciones.

¿Hay otra forma de resolver este problema, o forzar la generación de migraciones incluso si la base de datos ya existe y está sincronizada (y posiblemente falsificada)?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si el error se debe a las migraciones, puede omitir los errores de migración mientras ejecuta las pruebas utilizando la siguiente biblioteca Django

Django-test-sin-migraciones (pip install Django-test-sin-migraciones)

Instale la biblioteca y agréguela en INSTALLED_APPS (settings.py)

 Then run, python manage.py test --nomigrations

consulte: https://pypi.org/project/django-test-without-migrations/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!