tethysplatform / tethys

The Tethys Platform main Django website project repository.
http://tethysplatform.org/
BSD 2-Clause "Simplified" License
94 stars 51 forks source link

Revert "Custom back url for Native Tethys apps" #1041

Closed swainn closed 7 months ago

swainn commented 7 months ago

Reverts tethysplatform/tethys#1030

Discovered this PR puts Tethys in an unmigratable state. Trying to run tethys manage migrate or python manage.py migrate results in the following error:

``` $ tethys manage migrate WARNING:tethys.tethys_apps.admin:Unable to register CustomGroup. WARNING:tethys.tethys_apps.admin:Unable to register CustomGroup. Traceback (most recent call last): File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ psycopg2.errors.UndefinedColumn: column tethys_apps_tethysapp.back_url does not exist LINE 1: ...n_apps_library", "tethys_apps_tethysapp"."order", "tethys_ap... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/jdolinar/tethysdev/tethys/tethys_portal/manage.py", line 20, in execute_from_command_line(sys.argv) File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/base.py", line 89, in wrapped res = handle_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 75, in handle self.check(databases=[database]) File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/management/base.py", line 419, in check all_issues = checks.run_checks( ^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/checks/registry.py", line 76, in run_checks new_errors = check(app_configs=app_configs, databases=databases) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique all_namespaces = _load_all_namespaces(resolver) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces url_patterns = getattr(resolver, 'url_patterns', []) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/urls/resolvers.py", line 602, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/urls/resolvers.py", line 595, in urlconf_module return import_module(self.urlconf_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/importlib/__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1325, in _find_and_load_unlocked File "", line 929, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "/home/jdolinar/tethysdev/tethys/tethys_portal/urls.py", line 25, in from tethys_apps.urls import extension_urls File "/home/jdolinar/tethysdev/tethys/tethys_apps/urls.py", line 34, in standalone_app = get_configured_standalone_app() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/tethysdev/tethys/tethys_apps/utilities.py", line 627, in get_configured_standalone_app app = TethysApp.objects.first() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/models/query.py", line 674, in first for obj in (self if self.ordered else self.order_by('pk'))[:1]: File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/models/query.py", line 280, in __iter__ self._fetch_all() File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/models/query.py", line 1324, in _fetch_all self._result_cache = list(self._iterable_class(self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/models/query.py", line 51, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql cursor.execute(sql, params) File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/backends/utils.py", line 98, in execute return super().execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in _execute with self.db.wrap_database_errors: File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/jdolinar/miniconda3/envs/tethys/lib/python3.12/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django.db.utils.ProgrammingError: column tethys_apps_tethysapp.back_url does not exist LINE 1: ...n_apps_library", "tethys_apps_tethysapp"."order", "tethys_ap... ```
swainn commented 7 months ago

I should note that Tethys wouldn't start without running the migration b/c the back_url column didn't exist, so it was in an unusable state.