Je suis sur le point d'exécuter des cas de test dont l'erreur est inférieure à celle-ci.
Exécuter commond: python test manage.py
Tapez 'oui' si vous souhaitez essayer de supprimer la base de données de test 'test_project_management_db', ou 'non' pour annuler: oui Détruire l'ancienne base de données de test pour l'alias 'par défaut' ...
Traceback (most recent call last):
File "manage.py", line 24, in <module>
execute_from_command_line(sys.argv)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/management/commands/test.py", line 62, in handle
failures = test_runner.run_tests(test_labels)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/test/runner.py", line 601, in run_tests
old_config = self.setup_databases()
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/test/runner.py", line 546, in setup_databases
self.parallel, **kwargs
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/test/utils.py", line 187, in setup_databases
serialize=connection.settings_dict.get('TEST', {}).get('SERIALIZE', True),
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/db/backends/base/creation.py", line 77, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/db/backends/base/creation.py", line 121, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/core/serializers/base.py", line 80, in serialize
for count, obj in enumerate(queryset, start=1):
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/db/backends/base/creation.py", line 117, in get_objects
for obj in queryset.iterator():
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/home/Rails/Desktop/projects/envs/project_manage_env/local/lib/python2.7/site-packages/Django/db/models/sql/compiler.py", line 880, in execute_sql
cursor.close()
psycopg2.OperationalError: cursor "_Django_curs_140351416325888_23" does not exist
Lorsque j'ai rencontré ce problème, il s'est avéré que j'avais ajouté des champs à un modèle et oublié de makemigrations
et migrate
.
Normalement, vous recevez un avertissement de Django lorsque c'est le cas, mais pour une raison quelconque, je n'en ai pas reçu.