(Using the library django-tenants for tenant separated multi-tenancy) For PostGis support the docs say to add ORIGINAL_BACKEND = "django.contrib.gis.db.backends.postgis"
. I have this, however, when I go to create a new tenant I get the following error:
Traceback (most recent call last):
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesceleryapp race.py", line 382, in trace_task
R = retval = fun(*args, **kwargs)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesceleryapp race.py", line 641, in __protected_call__
return self.run(*args, **kwargs)
File "C:UsersColeDocumentsGitHubElevate-RA-Django-App
eturns_appapps enant_stores asks.py", line 28, in create_tenant_task
tenant.save()
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjango_tenantsmodels.py", line 93, in save
self.create_schema(check_if_exists=True, verbosity=verbosity)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjango_tenantsmodels.py", line 143, in create_schema
verbosity=verbosity)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangocoremanagement\__init__.py", line 141, in call_command
return command.execute(*args, **defaults)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangocoremanagementase.py", line 335, in execute
output = self.handle(*args, **options)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjango_tenantsmanagementcommandsmigrate_schemas.py", line 63, in handle
executor.run_migrations(tenants=tenants)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjango_tenantsmigration_executorsstandard.py", line 15, in run_migrations
run_migrations(self.args, self.options, self.codename, schema_name, idx=idx, count=len(tenants))
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjango_tenantsmigration_executorsase.py", line 34, in run_migrations
MigrateCommand(stdout=stdout, stderr=stderr).execute(*args, **options)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangocoremanagementase.py", line 335, in execute
output = self.handle(*args, **options)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangocoremanagementcommandsmigrate.py", line 77, in handle
connection.prepare_database()
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangocontribgisdbackendspostgisase.py", line 26, in prepare_database
cursor.execute("CREATE EXTENSION IF NOT EXISTS postgis")
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangodbackendsutils.py", line 100, in execute
return super().execute(sql, params)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangodbackendsutils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangodbackendsutils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangodbackendsutils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangodbutils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "c:userscoleappdatalocalprogramspythonpython36-32libsite-packagesdjangodbackendsutils.py", line 83, in _execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "spatial_ref_sys" does not exist
The spatial_ref_sys table exists within my public schema. The django.contrib.gis app is in my shared apps.
Any ideas?
See Question&Answers more detail:
os