openlibhums / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
168 stars 63 forks source link

core.0047_remove_dots_from_urls migration issue #2359

Closed nick-fournier closed 3 years ago

nick-fournier commented 3 years ago

Apologies if this is total user error, but I ran into an error when installing and applying this migration after running python3 manage.py install_janeway` and I'm completely stumped.

After some django error content, it raises this error (full error below): django.core.exceptions.FieldError: Cannot resolve keyword 'master' into field. Choices are: hvad_value, id, language_code

Not sure if it is a database issue? I'm using postgresql instead of mysql, but I seem to have set everything up correctly because it successfully applied other migrations.

The system is Ubuntu 20.04 on a Raspberry Pi 4. I know is not typical. Since it is arm64 and newer ubuntu, I had a lot of dependency issues trying to install out of the box (couldn't use docker), but after a few manual installs I got everything going.

I'm trying to install from the current master 961b73530faea4d2f1fe667b4c361a3c976ce4f0

Thanks in advance, appreciate any help I can get on this. Very eager to start working with janeway!

Operations to perform: Apply all migrations: admin, auth, carousel, cms, comms, contenttypes, copyediting, core, cron, django_summernote, featured, identifiers, journal, metrics, preprint, press, production, proofing, review, sessions, submission, utils Running migrations: Applying core.0047_remove_dots_from_urls...Traceback (most recent call last): File "manage.py", line 16, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/home/ubuntu/janeway/src/utils/management/commands/install_janeway.py", line 44, in handle call_command('migrate') File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 131, in call_command return command.execute(*args, **defaults) File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/migrate.py", line 202, in handle post_migrate_state = executor.migrate( File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/executor.py", line 115, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/usr/local/lib/python3.8/dist-packages/django/db/migrations/operations/special.py", line 193, in database_forwards self.code(from_state.apps, schema_editor) File "/home/ubuntu/janeway/src/core/migrations/0047_remove_dots_from_urls.py", line 17, in replace_setting_urls settings = SettingValueTranslation.objects.filter(master__setting__group__name="email") File "/usr/local/lib/python3.8/dist-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 787, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py", line 805, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py", line 1250, in add_q clause, _ = self._add_q(q_object, self.used_aliases) File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py", line 1273, in _add_q child_clause, needed_inner = self.build_filter( File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py", line 1154, in build_filter lookups, parts, reffed_expression = self.solve_lookup_type(arg) File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py", line 1034, in solve_lookup_type _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta()) File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/query.py", line 1351, in names_to_path raise FieldError("Cannot resolve keyword '%s' into field. " django.core.exceptions.FieldError: Cannot resolve keyword 'master' into field. Choices are: hvad_value, id, language_code

ajrbyers commented 3 years ago

Hey @nick-fournier - this is not at all your fault. We're in the middle of working on the version 1.4 release and so master is a bit unstable. There are a couple of migrations that will probably break because of the removal of that field. Are you setting Janeway up locally to do some coding/playing around or for a stable journal? (If the latter I would recommend either waiting a week or so for the next 1.4-RC or switching to v1.3.10).

nick-fournier commented 3 years ago

Thanks for the fast reply @ajrbyers ! Ah ok, I'm just doing some playing around, hoping to test out janeway and possibly make some custom plugins.

I'll see if I can grab the 1.3.10 version until 1.4 comes out.

ajrbyers commented 3 years ago

I've added a branch that may fix this for 1.4 if you run:

git pull
git checkout 2359-migration_fix

and try again (after clearing your db) it should work!

nick-fournier commented 3 years ago

Okay. After some more dependency quirks and a fight with apache2, I was able to get it up and running!

The virtualenv wasn't initializing properly, might be Ubuntu 20.04 related, and apparently the version of mysqlclient in requirements.txt doesn't play with arm64. Commenting it out and used postgresql.

Unfortunately now my Ubuntu install is chockas with junk I installed. I will try a fresh install with 1.4, I will take note of all missing dependencies along the way. I can also try using docker to see if I can get it running on a generic commercial host, like heroku.