luisapuppin / riscos

Sistema Gestão de Riscos
1 stars 1 forks source link

BUG: Tabela Monitoramento Heroku app #66

Closed luisapuppin closed 6 years ago

luisapuppin commented 6 years ago

Environment:

Request Method: GET Request URL: https://riscos.herokuapp.com/riscos/monitoramento/

Django Version: 2.0.4 Python Version: 3.6.4 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'riscos'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute

  1. return self.cursor.execute(sql, params)

The above exception (relation "riscos_monitoramento" does not exist LINE 1: ...dastro", "riscos_monitoramento"."ds_usuario" FROM "riscos_mo... ^ ) was the direct cause of the following exception:

File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner

  1. response = get_response(request)

File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/app/riscos/views.py" in fazer_monitoramento

  1. monitorados = [x.id_tratamento.pk for x in monitoramento]

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py" in iter

  1. self._fetch_all()

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py" in _fetch_all

  1. self._result_cache = list(self._iterable_class(self))

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py" in iter

  1. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql

  1. cursor.execute(sql, params)

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in execute

  1. return super().execute(sql, params)

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in execute

  1. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute_with_wrappers

  1. return executor(sql, params, many, context)

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute

  1. return self.cursor.execute(sql, params)

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/utils.py" in exit

  1. raise dj_exc_value.with_traceback(traceback) from exc_value

File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py" in _execute

  1. return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /riscos/monitoramento/ Exception Value: relation "riscos_monitoramento" does not exist LINE 1: ...dastro", "riscos_monitoramento"."ds_usuario" FROM "riscos_mo... ^

tomasbarcellos commented 6 years ago

No console do javascript havia a seguinte mensagem:

VM383:1674 Mixed Content: The page at 'https://riscos.herokuapp.com/riscos/monitoramento/' was loaded over a secure connection, but contains a form that targets an insecure endpoint 'http://dpaste.com/'. This endpoint should be made available over a secure connection.

luisapuppin commented 6 years ago

O bug ocorria devido a erro de comunicação entre a base de dados cadastrada anteriormente (Tabela de Tratamentos) e a tabela de Monitoramento incluída pelo PR #49. Para facilitar o contorno de futuros erros de base, o arquivo create_db.py foi atualizado com os dados existentes na base até agora. Erro dado como solucionado pelo commit 0595cb2714fdc47b7073b856e420e4fb2c73b7cf.