openlibhums / books

A plugin for Janeway that displays books.
0 stars 0 forks source link

Reverse for 'books_admin' not found #62

Closed bjarman closed 5 months ago

bjarman commented 5 months ago

Installation seems to have worked but when I visit the plugin page (...plugins/) I get this message:

"Some installed plugins failed to load: books" and this is the server log:

ERROR 2024-03-22 10:40:31,147 views P:7 T:139697489704704 [test] Importing plugin [books] 1.2 - True failed: Reverse for 'books_admin' not found. 'books_admin' is not a valid view function or pattern name. ERROR 2024-03-22 10:40:31,148 views P:7 T:139697489704704 [test] Reverse for 'books_admin' not found. 'books_admin' is not a valid view function or pattern name. Traceback (most recent call last): File "/vol/janeway/src/core/views.py", line 1773, in plugin_list reverse(manager_url) File "/usr/local/lib/python3.10/site-packages/django/urls/base.py", line 86, in reverse return resolver._reverse_with_prefix(view, prefix, *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/django/urls/resolvers.py", line 698, in _reverse_with_prefix raise NoReverseMatch(msg) django.urls.exceptions.NoReverseMatch: Reverse for 'books_admin' not found. 'books_admin' is not a valid view function or pattern name.

ajrbyers commented 5 months ago

Quick question: after cloning and installing the books plugin did you restart the server?

bjarman commented 5 months ago

No, should I have? Documentation just says to run python manage install_plugins.

ajrbyers commented 5 months ago

No, should I have? Documentation just says to run python manage install_plugins.

Yes - give it a try, I'll update the docs. If you don't restart the server django wont pickup the plugins urls.

bjarman commented 5 months ago

Ok, after restart I get this error when clicking on the "Books plugin" button:

ERROR 2024-03-22 11:05:38,542 log P:9 T:139774367082240 Internal Server Error: /test/plugins/books/admin/ Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedTable: relation "books_book" does not exist LINE 1: ...ormation", "books_book"."custom_how_to_cite" FROM "books_boo... ^

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

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view return view_func(request, args, **kwargs) File "/vol/janeway/src/plugins/books/views.py", line 123, in admin return render(request, template, context) File "/usr/local/lib/python3.10/site-packages/django/shortcuts.py", line 19, in render content = loader.render_to_string(template_name, context, request, using=using) File "/usr/local/lib/python3.10/site-packages/django/template/loader.py", line 62, in render_to_string return template.render(context, request) File "/usr/local/lib/python3.10/site-packages/django/template/backends/django.py", line 61, in render return self.template.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 170, in render return self._render(context) File "/usr/local/lib/python3.10/site-packages/django/test/utils.py", line 100, in instrumented_test_render return self.nodelist.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/loader_tags.py", line 150, in render return compiled_parent._render(context) File "/usr/local/lib/python3.10/site-packages/django/test/utils.py", line 100, in instrumented_test_render return self.nodelist.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/loader_tags.py", line 62, in render result = block.nodelist.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 938, in render bit = node.render_annotated(context) File "/usr/local/lib/python3.10/site-packages/django/template/base.py", line 905, in render_annotated return self.render(context) File "/usr/local/lib/python3.10/site-packages/django/template/defaulttags.py", line 171, in render len_values = len(values) File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 262, in len self._fetch_all() File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 1324, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/usr/local/lib/python3.10/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 "/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.10/site-packages/debug_toolbar/panels/sql/tracking.py", line 230, in execute return self._record(self.cursor.execute, sql, params) File "/usr/local/lib/python3.10/site-packages/debug_toolbar/panels/sql/tracking.py", line 154, in _record return method(sql, params) File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 98, in execute return super().execute(sql, params) File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 79, in _execute with self.db.wrap_database_errors: File "/usr/local/lib/python3.10/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.10/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "books_book" does not exist LINE 1: ...ormation", "books_book"."custom_how_to_cite" FROM "books_boo... ^

ajrbyers commented 5 months ago

I've updated the readme: https://github.com/BirkbeckCTP/books/blob/master/README.md

bjarman commented 5 months ago

Ok, after migrate things seems to be working. Thanks!