In trying to apply PR #108 to our local test instance I was having trouble so I just dropped all the tables in my database and tried again.
But then I started hitting a problem with the dbtemplates migration. Specifically
recordtransfer_rq_workers | Running migrations:
recordtransfer_rq_workers | Applying recordtransfer.0026_dbtemplates...Traceback (most recent call last):
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 581, in get_or_create
recordtransfer_rq_workers | return self.get(**kwargs), False
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 437, in get
recordtransfer_rq_workers | self.model._meta.object_name
recordtransfer_rq_workers | dbtemplates.models.DoesNotExist: Template matching query does not exist.
recordtransfer_rq_workers |
recordtransfer_rq_workers | During handling of the above exception, another exception occurred:
recordtransfer_rq_workers |
recordtransfer_rq_workers | Traceback (most recent call last):
recordtransfer_rq_workers | File "manage.py", line 26, in <module>
recordtransfer_rq_workers | main()
recordtransfer_rq_workers | File "manage.py", line 22, in main
recordtransfer_rq_workers | execute_from_command_line(sys.argv)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
recordtransfer_rq_workers | utility.execute()
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 413, in execute
recordtransfer_rq_workers | self.fetch_command(subcommand).run_from_argv(self.argv)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 354, in run_from_argv
recordtransfer_rq_workers | self.execute(*args, **cmd_options)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 398, in execute
recordtransfer_rq_workers | output = self.handle(*args, **options)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 89, in wrapped
recordtransfer_rq_workers | res = handle_func(*args, **kwargs)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 246, in handle
recordtransfer_rq_workers | fake_initial=fake_initial,
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
recordtransfer_rq_workers | state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
recordtransfer_rq_workers | state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
recordtransfer_rq_workers | state = migration.apply(state, schema_editor)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/migrations/migration.py", line 123, in apply
recordtransfer_rq_workers | operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
recordtransfer_rq_workers | self.code(from_state.apps, schema_editor)
recordtransfer_rq_workers | File "/app/recordtransfer/migrations/0026_dbtemplates.py", line 64, in populate_templates
recordtransfer_rq_workers | description=description,
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
recordtransfer_rq_workers | return getattr(self.get_queryset(), name)(*args, **kwargs)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 588, in get_or_create
recordtransfer_rq_workers | return self.create(**params), True
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 453, in create
recordtransfer_rq_workers | obj.save(force_insert=True, using=self.db)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/dbtemplates/models.py", line 63, in save
recordtransfer_rq_workers | super(Template, self).save(*args, **kwargs)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 740, in save
recordtransfer_rq_workers | force_update=force_update, update_fields=update_fields)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 789, in save_base
recordtransfer_rq_workers | update_fields=update_fields, raw=raw, using=using,
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 182, in send
recordtransfer_rq_workers | for receiver in self._live_receivers(sender)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 182, in <listcomp>
recordtransfer_rq_workers | for receiver in self._live_receivers(sender)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/dbtemplates/models.py", line 74, in add_default_site
recordtransfer_rq_workers | current_site = Site.objects.get_current()
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/contrib/sites/models.py", line 58, in get_current
recordtransfer_rq_workers | return self._get_site_by_id(site_id)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/contrib/sites/models.py", line 30, in _get_site_by_id
recordtransfer_rq_workers | site = self.get(pk=site_id)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
recordtransfer_rq_workers | return getattr(self.get_queryset(), name)(*args, **kwargs)
recordtransfer_rq_workers | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 437, in get
recordtransfer_rq_workers | self.model._meta.object_name
recordtransfer_rq_workers | django.contrib.sites.models.DoesNotExist: Site matching query does not exist.
The issue seems to be the default SITE_ID of 2, I added a SITE_ID=1 to our environment file and was able to pass by this. Probably because I have not yet added the new site (i.e. the actual hostname).
In trying to apply PR #108 to our local test instance I was having trouble so I just dropped all the tables in my database and tried again.
But then I started hitting a problem with the dbtemplates migration. Specifically
The issue seems to be the default SITE_ID of 2, I added a
SITE_ID=1
to our environment file and was able to pass by this. Probably because I have not yet added the new site (i.e. the actual hostname).