WhyNotHugo / django-mercadopago

⚠️ Deprecated. Use https://github.com/jazzband/django-payments/ instead.
ISC License
33 stars 12 forks source link

relation "mp_account" does not exist #29

Closed agustin-jimenez closed 3 years ago

agustin-jimenez commented 3 years ago

I got this error when create run 'python manage.py runserver'. The credentials used on the Account objects was tested and works.

Then I been trying reload the migrations and it still raising this error

File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedTable: relation "mp_account" does not exist LINE 1: ...ccount"."secret_key", "mp_account"."sandbox" FROM "mp_accoun... ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/local/lib/python3.7/threading.py", line 870, in run self._target(*self._args, self._kwargs) File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, *kwargs) File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", lin e 109, in inner_run autoreload.raise_last_exception() File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_las t_exception raise _exception[1] File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 357, in execute autoreload.check_errors(django.setup)() File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(args, kwargs) File "/usr/local/lib/python3.7/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_framesremoved File "/src/payment/models.py", line 83, in class MPPayment(models.Model): File "/src/payment/models.py", line 96, in MPPayment account = Account.objects.first() File "/usr/local/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 664, in first for obj in (self if self.ordered else self.order_by('pk'))[:1]: File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 276, in iter self._fetch_all() File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 1261, in _fetch_a ll self._result_cache = list(self._iterable_class(self)) File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 57, in iter results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1144, in e xecute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute return super().execute(sql, params) File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute _with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "mp_account" does not exist LINE 1: ...ccount"."secret_key", "mp_account"."sandbox" FROM "mp_accoun...

agustin-jimenez commented 3 years ago

It was my bad.

I beeing adding an Account intance referenced on my Model code. So when I trying to recreate the Database in a new environment that already not has migrations and so do not has this Account object already created, raises this error.

I hope that this log help